How to run scripts from command line in Windows
Running scripts to automate some simple tasks or some repetitive tasks are very common nowadays. Every operating system has got its own way of writing scripts to automate tasks and it sometimes varies from one flavor of operating system to another flavor.
For instance, Windows has got batch files, vb script and Linux has its own shell scripting methodologies. When it comes to windows most of us will definitely remember writing small scripts using Batch files having extension .bat. But batch files have limited ability to execute tasks so programmers generally use Visual basic scripts (vbs) to do such tasks. Today we are going to see how to use the same from command line because most of us are not aware of the built-in DOS command line utility.

Windows scripting was introduced mainly to administer networks, some operating system tasks like installing softwares, uninstalling softwares, log clearance and some OS specific tasks by programmers. Windows scripting is so powerful that you can use the same to automate tasks at system logon, log-off, scheduled tasks , to do some remote administration or to implement network policies in all the network computers by administrator. If the script is saved as a vbs file you can straight away execute the same from windows or you can use a command line tool called cscript to execute from command line.
Sample usage of the command is given below,
-
cscript <filename>
-
eg) cscript sample.vbs
-
cscript <filename> > <output filename>
-
eg) cscript sample.vbs > output.txt
To read more about scripting read this Microsoft Script Library. In my future posts I will be writing more about the basics of scripting and some useful scripting examples. Keep reading……
Popularity: 3% [?]
See Similar Posts




























