View Full Version : piping to another command


James
10-18-2005, 09:52 AM
i have a password.txt file that contain a password, say abc.

I need to run a decryption program and the software requires a passphase.
When manually run the decryption.exe file, it prompts

Enter passphase : <when i type password manually, screen suppose to be
blank, followed by enter>

therefore i thought of piping the password to the program by creating a
batch file

mybatch.bat
=========

decryption.exe | type password.txt

And the screen shows

Enter passphase : abc (and stops here)

When i press enter, it prompts

Enter passphase : <blank and it expects me to type a password>

How shld i pipe out correctly ?

Marty List
10-18-2005, 02:20 PM
"James" <jkklim@hotmail.com> wrote in message
news:O3yliD80FHA.3336@TK2MSFTNGP12.phx.gbl...
>i have a password.txt file that contain a password, say abc.
>
> I need to run a decryption program and the software requires a passphase.
> When manually run the decryption.exe file, it prompts
>
> Enter passphase : <when i type password manually, screen suppose to be
> blank, followed by enter>
>
> therefore i thought of piping the password to the program by creating a
> batch file
>
> mybatch.bat
> =========
>
> decryption.exe | type password.txt
>
> And the screen shows
>
> Enter passphase : abc (and stops here)
>
> When i press enter, it prompts
>
> Enter passphase : <blank and it expects me to type a password>
>
> How shld i pipe out correctly ?


Make sure password.txt contains a linefeed (press enter) after the password.

Try one of these:
type password.txt|decryption.exe
decryption.exe<password.txt

For more info, go to Start -> Help and Support and search for "using command
redirection operators".

rwh@rodharrison.com
10-18-2005, 09:21 PM
Try this
Example

for /f "Tokens=1" %%i in (c:\password.txt)

decription.exe %1