Hi, I am wanting to install a program into few hundreds computer.
My batch command at the moment includes copying the file from my local drive over the network computers and auto installation with psexec. Each installation takes around 2 minutes.
I am having an idea to just copy and paste all the IPs to a variable in a particular file, lets call it ABC. The batch file will call for the variable from ABC. Is there a way for me to just copy and paste all this IP under a variable without myself naming each variable? Thanks.
Variable and installation
Moderator: DosItHelp
Re: Variable and installation
Think you could use a FOR loop to read the file. So you can use allways the same variable fo each iteration.
ABC.txt
batch file
Place your stuff in subroutine :proc.
Regards
aGerman
ABC.txt
Code: Select all
123.456.234.567
345.678.456.789
batch file
Code: Select all
@echo off &setlocal
for /f %%a in (ABC.txt) do (
set "IPaddr=%%a"
call :proc
)
pause
goto :eof
:: ~~~~~~~~
:proc
echo %IPaddr%
goto :eof
Place your stuff in subroutine :proc.
Regards
aGerman
Re: Variable and installation
I am trying to set different variables in a file (abc.txt)
set file1=c:\file2.exe
set file2=c:\file1.exe
How do I call for different variables (%file1%, %file2%) from abc.txt?
set file1=c:\file2.exe
set file2=c:\file1.exe
How do I call for different variables (%file1%, %file2%) from abc.txt?
Re: Variable and installation
This way?
ABC.txt
Batch file:
[Edit: SET removed /]
Regards
aGerman
ABC.txt
Code: Select all
set file1=c:\file2.exe
set file2=c:\file1.exe
Batch file:
Code: Select all
@echo off &setlocal
for /f "delims=" %%a in (ABC.txt) do %%a
echo %file1%
echo %file2%
pause
[Edit: SET removed /]
Regards
aGerman
Re: Variable and installation
Thanks aGerman, your a god send