George,
I can get it to spawn a DOS window, by just using command.com as the DocApp:
?shellexecute( h, "open", "command.com", "", "c:\", 1 )I can get it to run a bat file just using the .bat as the DocApp:
?shellexecute( h, "open", "c:\test1.bat", "", "c:\", 1 )I can get it to run xcopy:
?shellexecute( h, "open", "xcopy", "autoexec.bat autoexec.xyz", "c:\", 1 )I can't get it to run one of the DOS internal commands though.... that was until I went spelunking in command.com with the old PCMag DR utility...
This works great lasts a long time:
?shellexecute( h, "open", "command.com", "/c copy autoexec.bat autoexec.xyz", "c:\", 1 ) The window flashes up then goes away.
If you use a /k switch command.com will not terminate when it's done.
Ain't DOS grand?This is all tested under Win95.
>As far as DOS commands, your post pointed out something I did wrong with that. While in the midst of goofying around with it, my machine locked up. When I rebooted (and it being Friday, my typical "duh"-day. :-)) I inadvertantly inverted the second and third parameters. Now know why I kept getting ERROR_FILE_NOT_FOUND (2).
>
>To make ShellExecute() work with DOS commands, pass COMMAND.COM as the program to execute, and the command as the parameters. For example:
>lcdos = "C:\COMMAND.COM"
>lcop = "open"
>lcdir = ""
>lcparms = "COPY AUTOEXEC.BAT AUTOEXEC.FOO"
>* Execute in minized window
>lnresult = ShellExecute(0, @lcop, @lcdos, @lcparms, @lcdir, 7)
>Thanks for the post, David.