Digital Compendium
Google
Translate to EnglishÜbersetzen Sie zum Deutsch/GermanTraduzca al Español/SpanishTraduisez au Français/FrenchTraduca ad Italiano/ItalianTraduza ao Português/Portuguese日本語に翻訳しなさい /Japanese
한국어에게 번역하십시오/Korean中文翻译/Chinese Simplified中文翻译/Chinese Traditionalترجمة الى العربية/ArabicVertaal aan het Nederlands/DutchΜεταφράστε στα ελληνικά/GreekПереведите к русскому/Russian
Plugin by Taragana

How to run scripts from command line in Windows

script 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.

command prompt

command 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% [?]

Share or Bookmark: These icons link to social bookmarking sites where readers can share and discover new web pages. Digg Sphinn del.icio.us Facebook Mixx Google


 

See Similar Posts

 

Leave a Comment