Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling a DOS Shortcut with the shell command

Status
Not open for further replies.

princessk1

Programmer
Feb 28, 2002
74
0
0
CA
Hi there,

I am trying to call an exe using the Shell command. The exe was created by another user and is a dos shortcut. My program passes over the line that calls the exe without error but the exe doesn't run. Here is the line of code I am using:

Shell("C:\PROGRA~1\POLLING\FILESA~1\GWBASIC.EXE 4305prog")

The user that created the exe told me to copy the cmd line from the properties window of the DOS shortcut and use it to call the exe.

Any ideas as to why this won't execute the external program?

Thanks in advance.
 
Are you working on the same machine that the other programmer created the shortcut on? Does the shortcut work?
 
I am not working on the same machine the shortcut was created on but the shortcut does work if you double click on it. Another thing I noticed is when I pass over the line containing the shell command, a DOS window does open for about half a second, but the exe does not execute.

Thanks for any ideas you can give me.
 
The Shell command must be working, otherwise VB would throw a runtime error and you'd see the "End/Debug" dialog.

So the real question is why does GWBasic find what it needs when run as a shortcut, but not under control of your VB program. (The answer might be flying by in that DOS box.)

Go back to the shortcut's properties: anything in the "Start in" text box?
 
The properties does not have a "Start in" text box that I can see. Under the Program tab, it has the cmd line (which is the same as my filepath), working: & batch file: - which are both empty, shortcut key - which says 'None' and Run: which says 'Minimized'.

Thanks again.
 
I take it you're on Win 95? Run minimized? So what does this program do?

Begin that it's written in GWBasic, how hard would it be to just pull the code into your VB program and do a little conversion?
 
Thanks for your help. I added the working directory to the "Working:" text box in the shortcuts properties and it now works.

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top