Hey, I'm trying to make a script to copy a file from the desktop of the PC to other computers on the network, but I want to copy only the computers that ping, for example, if the pc dribbles it copy, otherwise it skips this host goes to the other.
This is working, but if the machine is off, the bat will wait and I want to skip if it does not ping.
@echo ----------------------------------------------------------------------
@echo Voce esta prestes a copiar o "CMD" para todas as maquinas.
@echo.
@echo Tem certeza que deseja fazer isso?
@echo ----------------------------------------------------------------------
@echo.
choice /C SN /M "Sim/Nao "
IF errorlevel=2 goto NAO
IF errorlevel=1 goto SIM
:SIM
echo Você escolheu SIM..
echo.
FOR /L %%C IN (10,1,60) DO
(
echo estacao%%C
copy cmd.cmd \estacao%%C\c$\Users\Public\Desktop\
)
:NAO
exit
I can not get the ping state to validate.
@echo ----------------------------------------------------------------------
@echo Voce esta prestes a copiar o "CMD" para todas as maquinas.
@echo.
@echo Tem certeza que deseja fazer isso?
@echo ----------------------------------------------------------------------
@echo.
choice /C SN /M "Sim/Nao "
IF errorlevel=2 goto NAO
IF errorlevel=1 goto SIM
:SIM
echo Você escolheu SIM..
echo.
FOR /L %%C IN (10,1,60) DO
(
echo estacao%%C
ping -n 1 estacao%%C
IF not %ERRORLEVEL% == 1 (
copy cmd.cmd \estacao%%C\c$\Users\Public\Desktop\
)
)
:NAO
exit