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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help understanding how to call files in directorys 1

Status
Not open for further replies.

guru533

MIS
Aug 22, 2002
25
US
I need help understanding how VBScript locate files. For example, I have a VBScript located in C:\program files\test\test1. I want to call an .exe file located in that same folder, do I have to use the whole line, "Wshshell.run C:\program files\test\test1\sample.exe" or can I just use "WshShell.run \\test1\sample.exe"?

I would prefer to use the second line in one way or another, because using the whole line will probably cause problems in the future. I ran tests using the second line and have had mixed results. I haven't been able to find any definite definition that tells me exactly how VBScript interprets these lines. I know in DOS, it would look in the current directory first. Thanks for any help in advance.
 
use the whole directory name with quotes around it if the directory name has a space.
 
If you are calling the .exe from the same directory as the script, you can use:

WshShell.run ".\sample.exe".

Dana Hallenbeck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top