nawazlj
nawazlj

Reputation: 821

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

Upvotes: 1

Views: 102

Answers (1)

Stephan
Stephan

Reputation: 56180

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))

Upvotes: 4

Related Questions