Windows IT Pro is the leading independent community for IT professionals deploying Microsoft Windows server and client applications and technologies.
  
  
  Advanced Search 


December 12, 2005

WSH, Part 1: File Types

Clearing up WSH file–extension confusion
RSS
View this exclusive article with VIP access -- click here to join |
See More Windows Script Host (WSH) Articles Here | Reprints | Or sign up for our VIP Monthly Pass!

If you explicitly specify a host (e.g., when you preface the script's name with either the Cscript or Wscript command), you must also type the script's file extension. For example, the command

cscript hello 

won't work, but

cscript hello.vbs 

will (assuming, of course, that a script file named hello.vbs exists in the current directory). Typing a script name without a host or an extension at the command prompt causes the default host to execute the script.

To see which is the current default scripting host, right-click a script file in Windows Explorer. If the bold menu item is Open with Command Prompt, then the default host is CScript. If the bold menu item is Open, the default host is WScript.

Script File Properties
You can open a Properties dialog box for a script file by right-clicking the script file in Windows Explorer and choosing Properties. Go to the Script tab, which Figure 1 shows. The two options on this tab correspond to the //T and //Logo (or //Nologo) command-line options. If you change either of the options and click OK, Windows creates scriptname.wsh in the same directory as the script. The .wsh file is a plaintext file that contains the selected options; Figure 2 shows a sample .wsh file. The sample .wsh file's BatchMode setting isn't accessible via the GUI and corresponds to the //B command-line option. When it's set to zero (the default), the script will run in interactive mode (//I); if set to 1, the script will run in batch mode (//B). If you want to use this setting, you'll need to open the .wsh file in Notepad or another editor and add the setting. . . .


Already a VIP member?
Please log on to view the full article

Why become a VIP member?

VIP-only online access
VIP CD delivered twice a year: offline access to the entire Windows IT Pro article library
Monthly issue of your choice of Windows IT Pro or SQL Server Magazine

Subscribe Now
Reader Comments

You must be a registered user or online subscriber to comment on this article. Please log on before posting a comment. Are you a new visitor? Register now




Top Viewed ArticlesView all articles
WinInfo Short Takes: Week of November 23, 2009

An often irreverent look at some of the week's other news, including some post-PDC some soul searching, a Google Chrome OS announcement and a Microsoft response, Windows 7 off to a supposedly strong start, the Jonas Brothers and Xbox 360, and so much more ...

2009 Windows IT Pro Editors' Best and Community Choice Awards

Picking a favorite product from an impressive crowd of competitive offerings is never an easy task, and such was the case with our Editors' Best and Community Choice awards this year. ...

Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...


Scripting Whitepapers From Development to Production: Streamlining SharePoint Deployment with DocAve Deployment Manager

Related Events Check out our list of Free Email Newsletters!

Scripting eBooks Keeping Your Business Safe from Attack: Encryption and Certificate Services

Best Practices for Managing Linux and UNIX Servers

Building an Effective Reporting System

Related Scripting Resources Introducing Left-Brain.com, the online IT bookstore
Looking for books, CDs, toolkits, eBooks? Prime your mind at Left-Brain.com

Discover Windows IT Pro eLearning Series!
Clear & detailed technical information and helpful how-to's, all in our trademark no-nonsense format


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro DevProConnections IT Job Hound
Left-Brain.com Technology Resource Directory asp.netPRO ITTV Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 © 2009 Penton Media, Inc. Terms of Use | Privacy Statement