You are not logged in.

#1 04 Apr 2006 11:17

Paul
Member
Registered: 04 Apr 2006
Posts: 1

using UNC name in the CMD.exe isnt working

Hi all,
Im creating a VBA script which is running a shell on cmd "UNC path" but it still comming back with "The network path was not found.
The system cannot find the path specified." If I copy and paste the address directly in the CMD prompt it works???

this is the code:
Private Sub Command21_Click()
cmd = "cmd /k "
file = "\\Thos99data.nl.pntpost.com\occ&sqa$\OPS_Processes\Reports\CI label\test.imr"

' below is the NON UNC path
'file = "m:\OPS_Processes\Reports\CI label\test.imr"

filestring = Chr(34) & file & Chr(34)
Path = cmd + filestring

MsgBox Path
Call Shell(Path)

Please help Im really stuck with this one.

Offline

#2 04 Apr 2006 18:44

Simon Sheppard
Admin
Registered: 27 Aug 2005
Posts: 1,130
Website

Re: using UNC name in the CMD.exe isnt working

I think the problem may be this in the pathname:
occ&sqa$
try either renaming that share or escaping the & as ^& in the variable
occ^&sqa$

see
http://ss64.com/nt/syntax-redirection.html

Offline

Board footer

Powered by