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!

UNC naming in wscript.shell.run?

Status
Not open for further replies.

AlexIT

Technical User
Jul 27, 2001
802
US
I was using this:

Createobject("wscript.shell").run FileNm

but when FileNm = "//server/folder/file.txt" this fails with "The system cannot find the file specified"

If I manually browse and double click the file it opens in Notepad correctly. So I cannot use UNC with the .run?

Anyone else notice this?
 
Any space in FileNm ?
CreateObject("WScript.Shell").Run Chr(34) & FileNm & Chr(34)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
There aren't any spaces in the UNC path, but I will try your solution in a moment...
 
BTW, how about replacing this:
FileNm = "//server/folder/file.txt"
with this ?
FileNm = "[!]\\[/!]server[!]\[/!]folder[!]\[/!]file.txt"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Ha! I should have thought of this YESTERDAY
"\\server\folder\file.txt" works perfectly.

Thanks for your help!

(Now I wonder why the "N:/folder/file.txt" works?)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top