How to run VBScript from non-.VBS files

If your network administrator has prevented you from downloading or running .VBS files, you can get round this restriction by storing your VBScript in files of a different type: for example, .TXT.

Suppose that you want to run a file called C:\My Scripts\xxx.txt. The command to use is:

%SystemRoot%\System32\WScript.exe //E:vbscript "c:\My Scripts\xxx.txt"

You can create a Windows shortcut for a command like this, to save typing it every time.

Here is a sample macro in Cardbox that launches an external .VBS script stored in a .TXT file:

x="C:\My Scripts\xxx.txt"
Launch "%SystemRoot%\System32\WScript.exe","//E:vbscript """ & x & """"

Use Run instead of Launch if you want your macro to wait until the external script has completed.

Note: If you are using a Cardbox build earlier than 4249, you will have to replace %SystemRoot% with the actual name of your Windows directory: probably C:\Windows.

Advertisements

%d bloggers like this: