dima05605
11-12-2012, 22:14
Доброго времени суток! При выполнении кода пишет что wmic и ping не являются внутренними или внешними командами. Спасибо за помощь.
@echo off
:begin
if not exist start_server.txt goto :begin else goto :start_server
:start_server
Set file=exfile.txt
For /F "usebackq tokens=* delims=" %%i In ("%file%") Do Set exf=%%i
for /f "tokens=*" %%a in ('Dir /b/s/a-d C:\%exf%') Do Set path=%%a
echo %path%
set "wmic=wmic process call create "%path%" | findstr "ProcessId""
for /f "tokens=2 delims==;" %%i in ('"%wmic%"') do set "pid=%%i"
del start_server.txt
echo %pid% > pid.txt
ping -n 2 127.0.0.1
goto :begin
@echo off
:begin
if not exist start_server.txt goto :begin else goto :start_server
:start_server
Set file=exfile.txt
For /F "usebackq tokens=* delims=" %%i In ("%file%") Do Set exf=%%i
for /f "tokens=*" %%a in ('Dir /b/s/a-d C:\%exf%') Do Set path=%%a
echo %path%
set "wmic=wmic process call create "%path%" | findstr "ProcessId""
for /f "tokens=2 delims==;" %%i in ('"%wmic%"') do set "pid=%%i"
del start_server.txt
echo %pid% > pid.txt
ping -n 2 127.0.0.1
goto :begin