[英]Windows batch: Command not recognized
If I ran below batch file then it's working and 7z
and timeout
is recognized 如果我在批处理文件下运行,则它可以正常工作,并且
7z
和timeout
可以识别
FOR %%A IN (% C:\dfsdf_asdffd\dd_etgvssd%\*.axml) DO (
setlocal
set filename=%%A
call :tests
)
exit /b
:tests
set newname=%filename:~14%
set transname=%filename:~25%
timeout 5
7z e %newname%
move *.xml Agile_Original.xml
exit /b
But If I ran below batch file then cmd
is saying that 7z
, timeout
is not recognized. 但是,如果我在批处理文件下运行,则
cmd
表示7z
,无法识别timeout
。
For /F "tokens=1* delims==" %%A IN (Input_values.properties) DO (
IF "%%A"=="path" set path=%%B
IF "%%A"=="url" set url=%%B
IF "%%A"=="username" set username=%%B
IF "%%A"=="password" set password=%%B
IF "%%A"=="location" set location=%%B
)
FOR %%A IN (% C:\dfsdf_asdffd\dd_etgvssd%\*.axml) DO (
setlocal
set filename=%%A
call :tests
)
exit /b
:tests
set newname=%filename:~14%
set transname=%filename:~25%
timeout 5
7z e %newname%
move *.xml Agile_Original.xml
exit /b
As you can see I just added one loop to read contents from properties
file 如您所见,我刚刚添加了一个循环以从
properties
文件读取内容
don't use %path%
as a user variable. 不要将
%path%
用作用户变量。 It's a system variable that tells windows where to find it's executables. 这是一个系统变量,它告诉Windows在哪里可以找到它的可执行文件。 Change it to another name.
将其更改为另一个名称。
(same applies to %username%
, although it's not that critcal)) (同样适用于
%username%
,尽管不是那么重要))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.