Error using WSH Run method with long path names

Jimmy Bergmark

Usenet Archive
Joined
Dec 22, 2003
Messages
203
Reaction score
0
Using short paths it works but not with long paths, why?

Using Vlisp this doesn't work:
(setq WshShell (vlax-create-object "WScript.Shell"))
(vlax-invoke-method wshshell 'Run """C:\\Program Files\\Autodesk\\Autodesk Express Viewer\\ExpressViewer.exe"" C:\\New Folder\\Test.DWF" 3 :vlax-false)

On the other hand this works:
(vlax-invoke-method wshshell 'Run "calc.exe" 3)

or

(vlax-invoke-method wshshell 'Run
"C:/Progra~1/Autodesk/Autode~1/Expres~1.exe C:\\New Folder\\Test.DWF" 3 :vlax-false)

Using VBA it works:
Public Sub test
Dim WshShell
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run """C:\Program Files\Autodesk\Autodesk Express Viewer\ExpressViewer.exe"" ""C:\New Folder\Test.DWF""", 3, False End Sub
 
Check your quotes:

(vlax-invoke-method
wshshell
'Run
"\"C:\\Program Files\\Autodesk\\Autodesk Express
Viewer\\ExpressViewer.exe\" C:\\Temp\\Test.DWF"
3
:vlax-false)

Note that I wrapped the long filename in escaped quotes (\") and only a single outer pair of quotes for the entire string.

--
R. Robert Bell, MCSE
www.AcadX.com

| Using short paths it works but not with long paths, why? | | Using Vlisp this doesn't work:
| (setq WshShell (vlax-create-object "WScript.Shell"))
| (vlax-invoke-method wshshell 'Run """C:\\Program Files\\Autodesk\\Autodesk | Express Viewer\\ExpressViewer.exe"" C:\\New Folder\\Test.DWF" 3 :vlax-false) | | On the other hand this works:
| (vlax-invoke-method wshshell 'Run "calc.exe" 3)
|
| or
|
| (vlax-invoke-method wshshell 'Run
| "C:/Progra~1/Autodesk/Autode~1/Expres~1.exe C:\\New Folder\\Test.DWF" 3 | :vlax-false) | | Using VBA it works:
| Public Sub test
| Dim WshShell
| Set WshShell = CreateObject("WScript.Shell")
| WshShell.Run """C:\Program Files\Autodesk\Autodesk Express | Viewer\ExpressViewer.exe"" ""C:\New Folder\Test.DWF""", 3, False | End Sub | | -- | Best Regards, Jimmy Bergmark | CAD and Database Developer Manager at www.pharmadule-emtunga.com | Take a look at the trial version of SmartPurger or | download some freeware at www.jtbworld.com | More on AutoCAD 2004; | www.jtbworld.com/autocad2004.htm | www.jtbworld.com/autocad2004tips.htm | | |
 

Latest threads

Back
Top