Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- prog = ""
- args = ""
- set xe = new regexp
- xe.pattern = "\s|[&<>|]"
- for i = 0 to wscript.arguments.count - 1
- if prog = "" then
- prog = wscript.arguments(i)
- else
- s = wscript.arguments(i)
- if xe.test(s) then s = """" & s & """"
- if args <> "" then
- args = args & " " & s
- else
- args = s
- end if
- end if
- next
- if prog = "" then wscript.quit
- set ws = createobject("wscript.shell")
- set fs = createobject("scripting.filesystemobject")
- set f = fs.opentextfile(prog, 1, false, 0)
- if f.read(2) = "MZ" then
- f.skip &H3a
- f.skip (asc(f.read(1)) or (asc(f.read(1)) * 256) or (asc(f.read(1)) * 65536) or (asc(f.read(1)) * 16777216)) - &H40
- if f.read(2) = "PE" then
- f.skip &H5a
- if (asc(f.read(1)) or (asc(f.read(1)) * 256)) = 3 then ws.run "cmd /c (" & prog & " " & args & ") & set/p a=Press any key to close this window...<nul & pause>nul", 1
- end if
- end if
- f.close
- ws.run prog & " " & args, 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement