Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '## You need to execute this using cscript
- '## Example Batch Script ##
- ' http://pastebin.com/GhQwh6ZU
- VBS_SHELL_LOOP
- Sub VBS_SHELL_LOOP()
- Dim VBS_SHELL_HISTORY
- Dim VBS_SHELL_CODE
- VBS_SHELL_HISTORY = ""
- While 1
- WScript.StdOut.Write vbCrLf & "VBS>"
- VBS_SHELL_CODE = WScript.StdIn.ReadLine()
- If VBS_SHELL_CODE = "exit" Then
- WScript.Quit -1
- ElseIf VBS_SHELL_CODE = "history" Then
- WScript.StdOut.WriteLine vbCrLf & VBS_SHELL_HISTORY
- Else
- VBS_SHELL_EXECUTE VBS_SHELL_CODE, True
- End If
- If VBS_SHELL_HISTORY = "" Then
- VBS_SHELL_HISTORY = VBS_SHELL_CODE
- Else
- VBS_SHELL_HISTORY = VBS_SHELL_HISTORY & vbCrLf & VBS_SHELL_CODE
- End If
- Wend
- End Sub
- Sub VBS_SHELL_EXECUTE(VBS_Shell_Code, ScopeIsGlobal)
- On Error Resume Next
- If ScopeIsGlobal Then
- ExecuteGlobal VBS_Shell_Code
- Else
- Execute VBS_Shell_Code
- End If
- If Err Then
- WScript.StdErr.WriteLine "---" & vbCrLf & _
- "Err: " & vbCrLf & _
- vbTab & "Number: " & Err.Number & vbCrLf & _
- vbTab & "Description: " & Err.Description & vbCrLf & _
- vbTab & "Source: " & Err.Source & vbCrLf & _
- "..."
- End If
- On Error Goto 0
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment