Allowing Input within For Loop

Home Forums Scripting DOS Command Shell Allowing Input within For Loop

Viewing 1 post (of 1 total)
  • Author
    Posts
  • Avatar
    ekrengel
    Member
    #154704

    Hello,

    I’m trying to log specific output of a program “cdpr.exe”, to a file. The issue is, that the cdpr program requires a couple input commands. How can I allow this within the following batch file, and still create my txt file for logging the specific output?


    @echo
    on & SETLOCAL & Title CDPR

    SET “sProgram=Cdpr.exe”
    SET “sResults=2xUsers.txt”
    IF NOT exist “%sProgram%” goto :ERROR

    FOR /F “delims=” %%A IN (‘%sProgram% ^| findstr /b /i /c:”value:”‘) DO (
    REM ##trim the incipient spaces of %%B and set the value to %%C
    FOR /F “tokens=*” %%C IN (“%%B”) DO (
    echo %%C >> %sResults%
    )
    )

    :ERROR
    echo There was an error in the path…
    goto:eof[/CODE][CODE]@echo on & SETLOCAL & Title CDPR

    SET “sProgram=Cdpr.exe”
    SET “sResults=2xUsers.txt”
    IF NOT exist “%sProgram%” goto :ERROR

    FOR /F “delims=” %%A IN (‘%sProgram% ^| findstr /b /i /c:”value:”‘) DO (
    REM ##trim the incipient spaces of %%B and set the value to %%C
    FOR /F “tokens=*” %%C IN (“%%B”) DO (
    echo %%C >> %sResults%
    )
    )

    :ERROR
    echo There was an error in the path…
    goto:eof[/CODE]

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.