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
4
votes
1 answer

Getting javascript to run a process if it's not already running

I want to have Javascript run say cmd.exe if there is already not one running. I was hoping there is a way to have javascript look at running processes and then if the name is in the list dont run. but if it's not run the process.
Dennis Hayden
  • 184
  • 1
  • 5
  • 15
4
votes
1 answer

How do I identify a tab if it is open and refresh with the new hyperlink in Vbscript?

I have a script that opens a hyperlink with a variable to pull up the particular account on the intranet. However, if the "module" is open already (80% of the hyperlink is the same), I would like to just keep the same tab/window open and refresh it.…
sheldonhull
  • 1,807
  • 2
  • 26
  • 44
4
votes
2 answers

WSH scripts unit testing framework

I'm looking for a unit testing framework for WSH scripts (vbs/wsf, not VB6, VBA). I can't find anything except this project (looks good, but last activity was recorder around 2 years ago, haven't tested it…
AmonPL
  • 43
  • 3
4
votes
2 answers

JScript version availability for WSH installations

I'm not sure if JScript for WSH is available in every windows installation. Which version of JScript is available for WSH, and in which windows version? Please provide the link to an authoritative source.
George Polevoy
  • 7,450
  • 3
  • 36
  • 61
4
votes
2 answers

Single Line Input VBS Autotyper

I am currently trying to make an autotyper in VBS and I cannot figure out how to easily input what is to be typed. Right now, this is what my code has to look like: Set WshShell = WScript.CreateObject("WScript.Shell") WshShell.AppActivate…
4
votes
2 answers

How to link a static library using WAF?

I'm using OpenSSL in my C++ program, and I need to link crypto and ssl with it. If it were for example gcc, I would just pass: -lcrypto -lssl I am adding this dependency in Network-Simulator 3. But I don't know how to do this in WAF. How should I…
thenakulchawla
  • 5,024
  • 7
  • 30
  • 42
4
votes
3 answers

Is there a log4j equivalent for VBScript?

I need to instrument a series of .wsf and .vbs files with debug statements; before I go off and roll my own, does something like log4j exist for WSF/VBScript?
Patrick Cuff
  • 28,540
  • 12
  • 67
  • 94
4
votes
4 answers

Unicode named Folder shows ? in wscript prompt

I am facing problems with Unicode named folders. When I drag the folder to the script, it doesn't show the path of the folder properly. Simple VBScript (this is just a portion of it): Dim Wshso : Set Wshso = WScript.CreateObject("WScript.Shell") Dim…
Alex Cheng
  • 691
  • 2
  • 9
  • 21
4
votes
1 answer

msbuild fails creating COM wrapper for "Windows Script Host Object Model"

The situation I just reinstalled windows 10 and my dev tools, while keeping my data I am using VS2015 update 3. I have a solution with several projects. The solution is under version control (git) and I am the only one in my team experiencing this…
ChrisM
  • 1,148
  • 8
  • 22
4
votes
3 answers

Using 32-bit COM object from C# or VBS on Vista 64-bit and getting error 80004005

I need some mind reading here, since I am trying to do what I do not completely understand. There is a 32-bit application (electronic trading application called CQG) which provides a COM API for external access. I have sample programs and scripts…
alexandroid
  • 1,469
  • 2
  • 15
  • 32
4
votes
3 answers

How to convert an image file to BMP programmatically using native Windows XP capabilities?

Is it possible to convert an image file to BMP format using WindowsXP's native libraries and scripting capabilities? I'm talking about WSH, JScript, VBS, etc... C++ is also good for what I need if it can be compiled with Dev-C++
GetFree
  • 40,278
  • 18
  • 77
  • 104
4
votes
2 answers

Cannot get python scripting working under WSH

I'm trying to get WSH to run Python .pys scripts and I'm hitting a wall - I've tried this on two machines now, W7x64 and Server2012, same result both time, cscript always comes back with: CScript Error: Can't find script engine "Python" Procedure…
gh0st
  • 87
  • 7
4
votes
3 answers

Unable to reference UNC paths while using wscript.shell from an ASP script?

I'm having a problem executing a command from a command line through an ASP script using the wscript.shell object. Here is my code: inPath =…
Ryan
  • 6,756
  • 13
  • 49
  • 68
4
votes
2 answers

Make an HTA file run as admin (elevated)

In wsf, vbs and js files you can easily find out if they run elevated and if not you can easily make them. The code I've written for that is this: EnsureElevatedPrivileges(); WScript.Echo("Running elevated now!"); function…
Forivin
  • 14,780
  • 27
  • 106
  • 199
4
votes
7 answers

How to show a popup without a browser

I need an "alert" type feature to troubleshoot an error. I am not using a browser and using javascript as windows administaration purposes. So is their a way to view a varibales value if I am not using a browser?
Luke101
  • 63,072
  • 85
  • 231
  • 359