How to run a WScript batch file ?

Posted on 2006-05-23
Medium Priority
Last Modified: 2013-12-03
I have a file with the following WScript code.  What type of file do I save it as so it will run ?

REM ** Set the Enviroment **

Dim objNetwork
Set objNetwork = CreateObject("WScript.Network")

REM ** Remove existing network printers **

objNetwork.RemovePrinterConnection "LPT1:", True

REM ** Attach the Network printers **

objNetwork.AddWindowsPrinterConnection "\\server\hp"
objNetwork.AddWindowsPrinterConnection "\\server\Generic"

REM ** Set the Default Printer **

Question by:MarionTaylor
1 Comment
LVL 16

Accepted Solution

mdiglio earned 2000 total points
ID: 16745955
You'll want to save this with a .vbs extension.
This is a Visual Basic Script

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question