Windows批处理:无法识别命令

时间:2016-06-28 07:00:59

标签: windows batch-file cmd

如果我在批处理文件下面运行,那么它正常工作,7ztimeout被识别

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

但如果我在批处理文件下面运行,那么cmd会说7ztimeout无法识别。

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

如您所见,我刚刚添加了一个循环来读取properties文件

中的内容

1 个答案:

答案 0 :(得分:4)

请勿将%path%用作用户变量。它是一个系统变量,告诉窗口在哪里可以找到它的可执行文件。将其更改为其他名称。

(同样适用于%username%,但