Question

I'm trying to run WSH script using cscript specifically in cmd I got this Error

Input Error: There is no script file specified.

using this command

cscript  c:\file.wsh

On windows 7 ultimate My WSH script simply writes a registry entry I don't want to use vbscript (.vbs) or wscript engine so how can I make my WSH script work ?

Was it helpful?

Solution

.WSH

The Windows Script Host control file (.wsh) is a text document in which you can customize the execution of one or more of your scripts. It is created automatically when you set the properties for a supported script file.

The following example illustrates a typical .wsh file:

[ScriptFile]
Path=C:\WINNT\Samples\WSH\showprop.vbs
[Options]
Timeout=0
DisplayLogo=1
BatchMode=0

The path information in the [ScriptFile] section identifies the script file that is associated with the .wsh file. The keys in the [Options] section correspond to settings in the Script tab within the Properties dialog box.

Note:

  • You must have the original script file present when executing the .wsh file. If the .wsh file fails to run the script, check the Path= information in the .wsh file to ensure that it points to the script you are attempting to run.
  • When you double-click a .wsh file or run it from the command line, CScript.exe or WScript.exe reads the .wsh file to determine the specific settings that should be used to execute the script. CScript/WScript executes the original script, passing in the properties that are defined within the .wsh file.
  • It's not possible to specify script parameters with the .wsh file. You must run the script (either the script file or the .wsh file) from a command prompt to add the parameters.

Resource: Setting and Customizing Script Properties (.wsh)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top