How To Run The Vbs Script

Table of contents:

How To Run The Vbs Script
How To Run The Vbs Script

Video: How To Run The Vbs Script

Video: How To Run The Vbs Script
Video: run vbscript programming on windows cmd by cscript command ('HelloWorld') 2024, December
Anonim

Vbs scripts are usually used to process data, manage the system, work with computer and user accounts. They also help to interact with office applications, work with databases. All in all, an irreplaceable area for any programmer.

How to run the vbs script
How to run the vbs script

Instructions

Step 1

Run the file with the *.vbs extension by double clicking the mouse or call it by name in the console. To do this, go to the start / run menu and type the path to the required file in the window that opens. This is the most common text document that you can easily edit in a notepad. This method is the most understandable and simple, but sometimes, due to certain circumstances, it does not work (the system does not support the format, the encoding has failed, etc.).

Step 2

If the file with the *.vbs extension does not open, check for VBS interpreters. There should be two of them in the system: console CScript and windowed WScript (together they are Windows Script Host or WSH). They, in theory, should be immediately installed along with the system, but sometimes it turns out that they are either damaged or not installed at all (maybe on older versions of systems). If interpreters are not available, install them on your computer and double-click the script to run the script.

Step 3

Create a plain text file with txt extension. Copy this text there: Sub Run (ByVal sFile) Dim shellSet shell = CreateObject ("WScript. Shell") shell. Run Chr (34) & sFile & Chr (34), 1, falseSet shell = NothingEnd SubRun "C: / Program Files / FileZilla FTP Client / filezilla.exe "Naturally, replace the path with your executable file. Then rename the previously created txt file to vbs extension. To check it, double-click on it with the mouse, and the program will start at the specified path.

Step 4

To refer to the Windows Script Host method, specify the object and method with the required parameters (separated by a dot). You also specify WSH properties, but they can be assigned and read into variables and other properties. Always consider the data type of properties and variables, otherwise the script will throw an error about data type incompatibility.

Recommended: