windows - Ping remote computer from another remote computer and get result back -
i'm trying batch script work whereby computer on script running computer b ping computer c , errorlevel can output. @ moment i'm trying using psexec access command line on computer b , getting ping c. issue of course errorlevel comes "0" since command executing on b. result c need.
set /p altterm=please specify terminal test [0**]? echo. echo running internal ping test terminal %altterm%... psexec \\%hostname%-%altterm% ping %hostname%-%terminal% if errorlevel 0 set internalping=pass if errorlevel 1 set internalping=fail echo. echo internal ping test %internalping%
the details hostname , terminal set earlier in script. it's important script not display workings show echo lines , result. have used
/f >nul 2>&1
elsewhere in script suppress output
according windows pro (referred in microsoft technet):
psexec displays process's exit code , returns exit code own exit code.
so, batch should work.
put echo errorlevel=%errorlevel%
after psexec ...
sure.
to disable outputing, append >nul 2>nul
or >nul 2>&1
psexec ...
command-line. without /f
used (where did it???)
Comments
Post a Comment