hi does anyone know how to do the following?
i have a BAT Script which has the following in
Rgprefresh /m:COMPUTERNAME /force
i want it so that when i run it asks for the COMPUTERNAME and inserts it into the script
any ideads
hi does anyone know how to do the following?
i have a BAT Script which has the following in
Rgprefresh /m:COMPUTERNAME /force
i want it so that when i run it asks for the COMPUTERNAME and inserts it into the script
any ideads
You can use "copy con" if you are willing to press ctrl+z before enter... If not, you can work around it a bit but see if this is ok first (demo below).
Code:@echo off echo Enter some text, followed by ctrl+z, enter copy con userin echo you typed: type userin pause
update: Just remembered, you may want to delete the temp file "userin" once your script is completed. Can of course be done automatically from within the batch file.
not sure how u mean how do i add it to the file i need
Replace the line
withCode:Rgprefresh /m:COMPUTERNAME /force
Code:echo Enter the computer name (followed by ctrl+z then enter) copy con COMPUTERNAME Rgprefresh /m:COMPUTERNAME /force del ./COMPUTERNAME
do you mean a batch file
if so you have two options
1 - use your enviroment variable
so in the batch file the variable COMPUTERNAME needs to be %COMPUTERNAME% - therefore you can run this on any computer and the batch file will use the enviroment variable and parse it to the command
thus you batch file would be
Rgprefresh /m:%COMPUTERNAME% /force
2 - use the variable in a batch file
in your batch file subsititue the variable COMPUTERNAME to %1
when you run the batch file you run it with the computer name
thsui you batch file would be
Rgprefresh /m:%1 /force
so for example if the computer name is OFFICE you run as follows
<batch file> %1
and the name OFFICE is parse to the batch file under the variable %1
Last edited by zappp64; 18th November 2006 at 07:35 PM.
Social Networking Bookmarks