简体   繁体   中英

Windows batch: Command not recognized

If I ran below batch file then it's working and 7z and timeout is recognized

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.

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

don't use %path% as a user variable. It's a system variable that tells windows where to find it's executables. Change it to another name.

(same applies to %username% , although it's not that critcal))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM