David M...
December 5th 03, 07:45 AM
I am using VBScript to write some system management
scripts on XP.
I am having problems when a full path filename contains
spaces:
e.g. I define a constant string as
Const defragcmd = "C:\Program Files\Norton
SystemWorks\Speed Disk\sdntc.exe"
Then try to run it using WSH:
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run defragcmd , 1, true
This fails as script reports can not find specified file.
I get the same error with
WshShell.Run """defragcmd""" , 1, true
How can I pass the filename containing spaces to WSH?
What I am trying to do is run the defragcmd on several
disks so the first part of the cmd is the constant then I
want to add the options before calling WSH e.g.
cmd =defragcmd & " -drive=" & osdisk & " -auto"
But I am stuck with that space in the full path name. Any
ways round this?
Thanks
David
scripts on XP.
I am having problems when a full path filename contains
spaces:
e.g. I define a constant string as
Const defragcmd = "C:\Program Files\Norton
SystemWorks\Speed Disk\sdntc.exe"
Then try to run it using WSH:
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run defragcmd , 1, true
This fails as script reports can not find specified file.
I get the same error with
WshShell.Run """defragcmd""" , 1, true
How can I pass the filename containing spaces to WSH?
What I am trying to do is run the defragcmd on several
disks so the first part of the cmd is the constant then I
want to add the options before calling WSH e.g.
cmd =defragcmd & " -drive=" & osdisk & " -auto"
But I am stuck with that space in the full path name. Any
ways round this?
Thanks
David