The IndexWhat's changed on DarkAge.co.ukDownload fastpush and other toolsFrequently asked questionsHow to... do thingsSupport for old versions of WindowsNews & noise!Drop me a lineGet me outta here!

The Dark Age Blog


Saturday, September 15, 2007

 

Fun with CMD scripts

Khiat Kurniawan wrote in asking:

I am trying to deploy VNC to multiple computers. I have created machines.cmd and put the list of computer as below. I put machines.cmd
and vnc.cmd in the same folder, open command prompt, go to the directory, type in machines.cmd and hit enter. However, only 1 computer is processed. Did I miss something here? How to make the script go through all computers?

vnc CAF0007WP014 TestDomain\Admin mypass /log
vnc CAF0007WP032 TestDomain\Admin mypass /log
vnc CAF0008WP026 TestDomain\Admin mypass /log
vnc CAF0008WP030 TestDomain\Admin mypass /log


Well the simple answer is that when you call another CMD script, you need to put the word CALL in front of each line. Otherwise, the script will just run it the once and quit.

So:

@echo off
Call VNC Machine1 TestDomain\Admin mypass /log
Call VNC Machine2 TestDomain\Admin mypass /log
Call VNC Machine3 TestDomain\Admin mypass /log

If you have time, go and have a look at www.ss64.com. That site is a wealth of scripting ideas and is very useful for beginners and up.

Labels:


Archives

January 2007   February 2007   March 2007   April 2007   May 2007   June 2007   July 2007   September 2007  

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]