git @ Cat's Eye Technologies The-Dipple / 0335d1b
Require `Enter` from the user to close the console window. Cat's Eye Technologies 13 years ago
1 changed file(s) with 16 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
0 ' Force this WSH script to run in a console window,
1 ' even if it is started by double-cliking the .vbs file
0 ' This technique forces this WSH script to run in a console window,
1 ' even if it is started by double-clicking the .vbs file
22 ' in Windows Explorer.
3
4 ' I don't know if this will actually work or not yet :/
53
64 Option Explicit
75 Dim WshShell
6 Dim I
7 Dim Pause
88
99 If InStr(UCase(WScript.FullName), "CSCRIPT") = 0 Then
1010 Set WshShell = WScript.CreateObject("WScript.Shell")
11 WshShell.Run "CScript //Nologo " & WScript.ScriptFullName, 1, True
11 WshShell.Run "CScript //Nologo " & WScript.ScriptFullName & " /Pause", 1, True
1212 Else
1313 WScript.Echo "This should appear in a Console window"
14 'Remainder of your script goes here
15 Pause = False
16 For I = 0 to WScript.Arguments.Count - 1
17 If WScript.Arguments(I) = "/Pause" Then
18 Pause = True
19 End If
20 Next
21 If Pause Then
22 WScript.Echo "[Press Enter to close this window]"
23 WScript.StdIn.ReadLine
24 End If
1425 End If