Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change cscript.exe to wscript.exe execution for all VBScript files?

Tags:

wsh

vbscript

After installing the new server, I am facing an issue.

I have lot of .vbs files, all need to run in wscript, reason, I use all those command like WScript.Echo "hello"

I want to be able to see the output when I double click the VBScript file.

But when I right click on the vbs file, I see console, I want to change the default to Windows host, globally!

How can I do that?

like image 609
i need help Avatar asked Sep 23 '09 07:09

i need help


People also ask

What is the difference between Cscript and wscript?

WSCRIPT. EXE and CSCRIPT. EXE are almost exactly identical, except that one is flagged as a windows application and the other is flagged as a console application (Guess which way around!). So the answer is: If you want your script to have a console window, use CSCRIPT.

How do I run a wscript exe?

To run scripts using WScript.exeClick the Start button, and then click Run. In the Open field, type the full path of the script, and then click OK. You can also type WScript followed by the full name and path of the script you want to run.

What program runs .vbs files?

Visual Basic is a Windows-specific programming language, so you'll only be able to run your script using Windows.


2 Answers

Check the Windows Explorer settings for the filetype *.vbs (something like tools->options->file types etc.) and change the "open with" setting to cscript.

like image 104
Daren Thomas Avatar answered Oct 27 '22 15:10

Daren Thomas


You can change the default scripting host to wscript.exe like so:

wscript.exe //H:wscript

If you wish to set cscript as the default host, that works in the same way:

wscript.exe //H:cscript

You can execute cscript.exe with the same arguments for the same result.

like image 37
Fredrik Mörk Avatar answered Oct 27 '22 15:10

Fredrik Mörk