IMPORTANT: in the run section where cmd.exe gets executed, there is a switch, which you can change:
- cmd.exe /k - Keep the CMD Window open after script has run
- cmd.exe /c - Close the CMD Window after script has run
sub force_cscript
Dim Arg, Str
If Not LCase( Right( WScript.FullName, 12 ) ) = "\cscript.exe" Then
For Each Arg In WScript.Arguments
If InStr( Arg, " " ) Then Arg = """" & Arg & """"
Str = Str & " " & Arg
Next
CreateObject( "WScript.Shell" ).Run "cmd.exe /k " & "cscript //nologo """ & WScript.ScriptFullName & """" & Str
WScript.Quit
End If
end sub
No comments:
Post a Comment