IM&T SRFT
asked on
Help with spaces in a script
The following code works fine, unless FSOURCE and FDESTINATION have spaces in them. Please can somebody advise how I can handle spaces with it?
Thank you.
Set WshShell = WScript.CreateObject("WScript.Shell")
Return = WshShell.Run("%comspec% /C \\srhtimtss\SLogic\Files\Backup\robocopy /E /MIR /R:1 /W:1 /V /TEE /log:\\Srhtimtss\installlogs\VI_Logs\"&MyNumber&".txt "&FSOURCE&" "&FDESTINATION&"", 0, true)
Thank you.
ASKER
Unfortunately neither of those worked.
ASKER
I've just worked it out.
If anybody would like to see this in future, here's the solution:
If anybody would like to see this in future, here's the solution:
Set WshShell = WScript.CreateObject("WScript.Shell")
Return = WshShell.Run("%comspec% /C \\srhtimtss\SLogic\Files\Backup\robocopy /E /MIR /R:1 /W:1 /V /TEE /log:\\Srhtimtss\installlogs\VI_Logs\"&MyNumber&".txt """&FSOURCE&""" """&FDESTINATION&"""", 0, true)
You can also try:
"& "'" & [FSOURCE] & "'" & " " & "'" & [FDESTINATION] &"'" &"
That is a ' surrounded by quotes.
So that it is interpreted as
' FSOURCE '
"& "'" & [FSOURCE] & "'" & " " & "'" & [FDESTINATION] &"'" &"
That is a ' surrounded by quotes.
So that it is interpreted as
' FSOURCE '
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Thanks.
~bp
~bp
or it could be
"&[FSOURCE]&" "&[FDESTINATION]&"