Yes you're right. In fact this works too:
wd 'winexec *cmd /C "drive:/path to/file"'

The only downside is that it's not possible to give any options (such as
sw_hide) to winexec. 
    wd 'winexec *cmd /C start "" "drive:/path to/file" sw_hide'

I think these are interpreted as parameters to the application starting,
rather than parameters for winexec and so the cmd window displays
briefly. A bit ugly but I can live with it.

I was thinking that I could call the winapi function GetShortPathName
for my filename before I give it to: 
wd 'winexec "cmd /C ',filename,'" sw_hide'

I'm struggling to get the calling syntax right though. From
win32api.dat:
kernel32 GetShortPathName i *c *c i

>From MSDN: 
<http://msdn2.microsoft.com/en-US/library/aa364989.aspx>

DWORD WINAPI GetShortPathName(
  LPCTSTR lpszLongPath,
  LPTSTR lpszShortPath,
  DWORD cchBuffer
);

fln=: 'd:\Folder with spaces\File with spaces.xls'
'GetShortPathName'win32api fln;(,' ');#fln
|domain error
|       'GetShortPathName'win32api fln;(,' ');#fln

I think the bit I'm getting wrong is the 2nd parameter ... of course I
could be wrong about that too!!!


> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Oleg Kobchenko
> Sent: Thursday, 12 July 2007 04:15
> To: Programming forum
> Subject: RE: [Jprogramming] Open file with associated application
> 
> OK. According to "start" help, this should work:
> 
>    wd 'winexec *cmd /c start "" "path/to/file"'
> 
> 

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to