I need to create a .bat script that will be executed on single/multiple machines
I need first to create a bat that prompts for the computer name that the command will be executed on it
I prefer not to use Ps tools
I need to create a .bat script that will be executed on single/multiple machines
I need first to create a bat that prompts for the computer name that the command will be executed on it
I prefer not to use Ps tools
I prefer to provide a list of computernames:
@ECHO ON
set controlfile=control.txt
SETLOCAL DISABLEDELAYEDEXPANSION
FOR /F %%L IN (%controlfile%%) DO (
SET "line=%%L"
SETLOCAL ENABLEDELAYEDEXPANSION
ping !line!
)
ENDLOCAL
But I tested this and it seems fine.
@ECHO OFF
SET /P computername=Computername:
ping %computername%
(Yes, I just pinged them, you'd need to put your own code there.)