(1) Always echo the command before you try to feed it to run:
>> MyCmd = "Cmd /c CD /D " & qq("C:\Program Files (x86)\WinRAR") & " & a c:\new.rar c:\*.* "
>> WScript.Echo MyCmd
>>
Cmd /c CD /D "C:\Program Files (x86)\WinRAR" & a c:\new.rar c:\*.*
Obviously your concatenation puts a spurious "&" in the result.
(2) Never let you be persuaded to put random additions like "cmd /c cd /d" into you command.
(3) Build your command line in a structured way. E.g:
Option Explicit
Function qq(s) : qq = """" & s & """" : End Function
Dim sCmd : sCmd = Join(Array( _
qq("C:\Program Files (x86)\WinRAR") _
, "a" _
, qq("c:\some path with spaces\new.rar") _
, qq("c:\source dir with more spaces\*.*") _
))
WScript.Echo sCmd
output:
cscript y.vbs
"C:\Program Files (x86)\WinRAR" a "c:\some path with spaces\new.rar" "c:\source dir with more spaces\*.*"
See here for background and reasons why.
Update:
This way, blunders (just the path, not the full filespec of rar mentioned) can be spotted and corrected easily:
Option Explicit
Function qq(s) : qq = """" & s & """" : End Function
Dim sCmd : sCmd = Join(Array( _
qq("C:\Program Files (x86)\WinRAR\rar.exe") _
, "a" _
, qq("c:\some path with spaces\new.rar") _
, qq("c:\source dir with more spaces\*.*") _
))
WScript.Echo sCmd