Reputation: 205
I am a noob with vbs, here is a script (from How to run a file on background using vbscript with launch options). But the run doesn't work.
Option Explicit
Dim wshShell
Set WshShell = CreateObject("WScript.Shell")
Function qq(s) : qq = """" & s & """" : End Function
Sub mapF(a, f)
Dim i
For i = LBound(a) To UBound(a)
a(i) = f(a(i))
Next
End Sub
Dim sFSpec : sFSpec = "C:\Program Files\Pineapplesoft\Lost computer\lostcomputeraudio.bat"
Dim aParms : aParms = Split("1#/pi:pa po#last parm", "#")
mapF aParms, GetRef("qq")
Dim sCmd : sCmd = Join(Array( _
qq(sFSpec) _
, Join(aParms) _
))
WshShell.Run qq(sCmd)
Upvotes: 0
Views: 254
Reputation: 3510
qq(sCmd)
is returning This :
""C:\Program Files\Pineapplesoft\Lost computer\lostcomputeraudio.bat" "1" "/pi:pa po" "last parm""
You want :
"C:\Program Files\Pineapplesoft\Lost computer\lostcomputeraudio.bat" "1" "/pi:pa po" "last parm"
Remove the qq(sCmd)
function and it should work.
Option Explicit
Dim wshShell
Set WshShell = CreateObject("WScript.Shell")
Function qq(s) : qq = """" & s & """" : End Function
Sub mapF(a, f)
Dim i
For i = LBound(a) To UBound(a)
a(i) = f(a(i))
Next
End Sub
Dim sFSpec : sFSpec = "C:\Program Files\Pineapplesoft\Lost computer\lostcomputeraudio.bat"
Dim aParms : aParms = Split("1#/pi:pa po#last parm", "#")
mapF aParms, GetRef("qq")
Dim sCmd : sCmd = Join(Array( _
qq(sFSpec) _
, Join(aParms) _
))
wshShell.Run sCmd
Upvotes: 2
Reputation: 7
You can run Cmd like this
Set shell=CreateObject
Shell.Run("cmd.exe")
Upvotes: -1