简体   繁体   English

Windows批处理:无法识别命令

[英]Windows batch: Command not recognized

If I ran below batch file then it's working and 7z and timeout is recognized 如果我在批处理文件下运行,则它可以正常工作,并且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

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.

相关问题 Jenkins 作为 Windows 服务 - 运行 Windows 批处理命令<some program>不被认可 - Jenkins as Windows Service - Running Windows batch command <some program> is not recognized Windows碎片整理无法识别为内部或外部命令,可操作程序或批处理文件 - Windows defrag is not recognized as an internal or external command, operable program or batch file Windows 7 - &#39;make&#39; 不是内部或外部命令,也不是可运行的程序或批处理文件 - Windows 7 - 'make' is not recognized as an internal or external command, operable program or batch file Windows无法将Yiic识别为命令 - Yiic not recognized as command in windows 在Windows中无法将xmllint识别为命令 - xmllint is not recognized in Windows as command Windows批处理文件-Bin无法识别 - Windows batch file - bin not recognized Windows 2002中无法将“超时”识别为内部或外部命令,可操作程序或批处理文件 - 'timeout' is not recognized as internal or external command, operabable proggram or batch file in windows 2002 &#39;npm&#39; &#39;node&#39; 不是用于 Windows 的内部或外部命令,也不是可运行的程序或批处理文件 - 'npm' 'node' is not recognized as internal or external command, operable program or batch file for Windows 为什么在 Windows 上运行 `flask run` 会导致“flask 不是内部或外部命令、可运行程序或批处理文件” - Why does running `flask run` on Windows result in "flask is not recognized as an internal or external command, operable program or batch file" Windows-PHP-&#39;bin \\ behat&#39;不被识别为内部或外部命令,可操作程序或批处理文件 - Windows - PHP - 'bin\behat' is not recognized as an internal or external command, operable program or batch file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM