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

WScript.Run with path that contains spaces

Status
Not open for further replies.

bmquiroz

IS-IT--Management
Sep 26, 2003
207
US
Hi all,

I'm trying to execute the below process but it keeps failing due to the spaces in the path names. I know you have to enclose path\file names with spaces in double quotes just not sure where to add them in this one..

strCommand = "robocopy ""d:\Dir\Folder Test c:\Dir\Folder Test /MOV"""
objCommand.Run strCommand ,0

Thanks.

-Sip
 
strCommand = "robocopy [red]"[/red]""d:\Dir\Folder Test c:\Dir\Folder Test /MOV"""[red]"[/red]

Or

strCommand = "robocopy " & Chr(34) &"d:\Dir\Folder Test c:\Dir\Folder Test /MOV" & Chr(34)


I hope you find this post helpful.

Regards,

Mark
 
Thanks for the reply. I tried both lines but neither worked. When I close the spaces "Folder_Test" it works. Unfortunately the path I need to specify contains spaces. Back to googling...

-Sip
 
Try this instead:

Code:
SourceDir = "d:\Dir\Folder Test"
DestDir = "c:\Dir\Folder Test"

strCommand = "robocopy " & SourceDir & " " & DestDir & " /MOV"

I hope you find this post helpful.

Regards,

Mark
 
strCommand = "robocopy ""d:\Dir\Folder Test"" ""c:\Dir\Folder Test"" /MOV"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top