Windows Batch For Loop How? -
i have below code , repeat process based on input y @ line:
rem if value below y, repeat process set /p repeat=do want same other systems ?:
how do using loop?
@echo off :: list of systems vairable set "sb1=hannlsb1.mydomain.com:30515 -i 05" set "db1=hannlsd2.mydomain.com:31315 -i 13" set "qb1=hannlsqa1-1:30115 -i 01" set "db0=hannlsd1.mydomain.com -i 10" set "qb0=hannlsps1-1.mydomain.com-i 03" set "wb1=hannlsqa1-1:30315 -i 03" set "vb1=hannlsvt-1.mydomain.com -i 01" set /p isid=please enter isid: set /p pass=please enter password reset: rem need loop here setlocal enabledelayedexpansion set /p sysid=please enter systemid: /f "usebackq delims==" %%i in (`echo+!%sysid%!`) set val=%%i setlocal disabledelayedexpansion if not "%val%"=="" ( rem echo hello %sysid%, welcome dos inputs! echo %val% rem if value below y, repeat process set /p repeat=do want same other systems ?: ) else ( echo did not enter correct system id! bye bye!! ) pause
no need for. if
create separate subroutine.bat file params , code task.
then call subroutine command within subroutine. recursively.
or if want use loop , them enter sysid's in comma separated list first time: use loop call subroutine.bat sysid 1 of parameters.
Comments
Post a Comment