Questions tagged [wsh]

For questions relating to Windows Script Host (WSH), a language-independent scripting host for the Windows operating system. It allows scripts to be run from both the graphical Windows desktop (via WScript.exe) and the command prompt (via CScript.exe).

Windows Script Host (sometimes abbreviated as WSH), in both Wscript.exe and Cscript.exe guises, can run VBScript (*.VBS, *.VBE) and JScript (*.JS, *.JSE), via Microsoft-provided script engines that are bundled with the OS and installed by default.

In addition to VBScript and JScript, there are third-party script engines for WSH that you can download to allow the use of Python, REXX, Perl, and other languages. (The script engines that add into WSH are distinct from standalone script interpreters that might exist for those languages, on Windows).

Multiple languages can be mixed in Windows Script Files (*.WSF). These types of scripts may also be used to link many other external scripts together using a src parameter on the <script> tag in a manner similar to HTML. A WSF makes reference to each script module in a very basic XML hierarchy and it's a package that can be organized in jobs.

Regardless of whether the UI is console-based or graphical, the same underlying script engine is used. In UI mode, the host is WScript.exe (used by default); in console mode, the host is CScript.exe.

The Windows Script Host has been part of every Microsoft Windows operating system's installation since Windows 98.

In 2006, Microsoft released v1.0 of Windows PowerShell, which could be conceived as a replacement for, or successor of, Windows Script Host. PowerShell is now included in every Windows OS. Even so, WSH is still included in every Windows OS, and many Wscript programs will continue to be in service, for many years.

References:

Related tags:

1078 questions
6
votes
2 answers

Python, create shortcut with two paths and argument

I'm trying to create a shortcut through python that will launch a file in another program with an argument. E.g: "C:\file.exe" "C:\folder\file.ext" argument The code I've tried messing with: from win32com.client import Dispatch import os shell =…
coco4l
  • 115
  • 5
6
votes
2 answers

creating quoted path for shortcut with arguments in powershell

I have the following powershell code calling WSHShell which will create a shortcut in the start menu for Win7/8 but am unable to figure out how to get powershell to pass the quotes needed around the UNC path prior to the arguments in the target…
thatotheritguy
  • 83
  • 1
  • 1
  • 6
6
votes
3 answers

Future of Windows Script Host

What is the future of Windows Script Host ? Microsoft has announced, in may 2015, the end of VBscript and ActiveX in their new browser Windows Edge (and that's a good news for web standards, by the way). However, I can't find out recent information…
ced
  • 1,979
  • 2
  • 11
  • 9
6
votes
2 answers

File permissions with FileSystemObject - CScript.exe says one thing, Classic ASP says another

I have a classic ASP page - written in JScript - that's using Scripting.FileSystemObject to save files to a network share - and it's not working. ("Permission denied") The ASP page is running under IIS using Windows authentication, with…
Dylan Beattie
  • 53,688
  • 35
  • 128
  • 197
6
votes
10 answers

Creating a scripting language to be used to create web pages

I am creating a scripting language to be used to create web pages, but don't know exactly where to begin. I have a file that looks like this: mylanguagename(main) { OnLoad(protected) { Display(img, text, link); } …
anon271334
6
votes
3 answers

Issues running JScript or VBScript files with UTF-8 encoding thru Windows Script Host

I'm not sure if I'm doing something wrong, but I can't seem to run the following JScript through the Windows Script Host if I save it in a .js file with the UTF-8 encoding: var name = "Hello world!"; WScript.echo(name); When I run it, it gives me…
c00000fd
  • 20,994
  • 29
  • 177
  • 400
6
votes
4 answers

setTimeout not working in windows script (jscript)

When I try to run the following code in my program setTimeout("alert('moo')", 1000); I get the following error Error: Object expected Code: 800A138F Source: Microsoft JScript runtime error Why? Am I calling the wrong function? What I want to do is…
Sibo Lin
  • 339
  • 1
  • 5
  • 16
6
votes
1 answer

How can you get STDIN input to a WSH script using cscript.exe?

I'm trying to use WSH in place of DOS/Batch files. Thanks for the input!
qodeninja
  • 10,946
  • 30
  • 98
  • 152
6
votes
1 answer

Writing a language for the Windows Scripting Host (WSH)

Has anyone had any experience targetting WSH in the way that VBScript, JScript, PerlScript, xbScript and ForthScript (among other) do, such that the language can be used from the command line and embedded in server-side web pages? Where do I go to…
bugmagnet
  • 7,631
  • 8
  • 69
  • 131
6
votes
2 answers

How to know valid script engine names for CScript.exe's //E:engine option?

When you execute a file with .VBS, .JS or .WSF extensions via CScript.exe, they execute correctly: CScript vbsProg.vbs CScript jsProg.js CScript wshScript.wsf However, we may use //E:engine option to run VBS or JScript files with different…
Aacini
  • 65,180
  • 12
  • 72
  • 108
6
votes
3 answers

Is there a way to run a command line command from JScript (not javascript) in Windows Scripting Host (WSH) cscript.exe?

I'm writing a JScript program which is run in cscript.exe. Is it possible to run a commnad line command from within the script. It would really make the job easy, as I can run certain commands instead of writing more code in jscript to do the same…
detj
  • 5,299
  • 6
  • 30
  • 32
6
votes
3 answers

Why WScript.StdOut.Write method behaves differently in VBS vs. JScript?

I have two small programs in VBS and JScript: VBScript.vbs: For i=0 To 255 WScript.StdOut.Write Chr(i) Next JScript.js: for ( var i=0; i <= 255; ++i ) WScript.StdOut.Write(String.fromCharCode(i)); When I execute they in the command-prompt,…
Aacini
  • 65,180
  • 12
  • 72
  • 108
6
votes
0 answers

WSO2 WSF PHP - WSClientProxy->__call not returning big response

I've been trying to consume a service using WSClient in WSDL mode, but the response is always a array with an empty string. I'm using WSO2 WSF for PHP(WSO2 Web Services Framework for PHP) and my PHP version is 5.3. I think the problem could be the…
6
votes
3 answers

How can I determine if a file is locked using VBS?

I am writing a VB Script to update some files on the network. Before beginning, I want to know if any of the files are locked. I'd like to do this before I actually do any updates. I am aware that I can handle the error if the file is locked when I…
Jon B
  • 51,025
  • 31
  • 133
  • 161
6
votes
3 answers

Telnet Using Applets in JavaScript

I am trying to open a telnet window and send some keys to this active window. Below is the JavaScript code: var oWshShell = new ActiveXObject("WScript.Shell"); oWshShell.Run("telnet 43.43.22.45 23"); //oWshShell.Run("firefox.exe…
Avi
  • 368
  • 2
  • 13