Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

simulating enter in a batch file, won't let me pipe a txt file

simulating enter in a batch file, won't let me pipe a txt file

simulating enter in a batch file, won't let me pipe a txt file

I am trying to wrtie a batch file that will export my checkpoint firewall database using the upgrade_export.exe. The code i am using is:

upgrade_export.exe c:\backup (c:\backup been the place i want the output to go).

When i run this it asks for the enter key to be pressed to continue. The program will let you type anything and then enter. have tried using the following:

upgrade_export.exe c:\backup < cmds.txt (where cmds.txt has a random word typed in followed by a carriage return)

This results in the following error :

C:\Scripts\CPbackup>upgrade_export c:\backup   0<c:\scripts\CPbackup\cmds.txt
The system cannot find the file specified. same error if i specify the path or not (and the file is there!)

Having searched for a while the only thing people seem to do in this situation is what i have already tried, so i am out of ideas. Any suggestions / shots in the dark would be greatly welcomed


RE: simulating enter in a batch file, won't let me pipe a txt file

I have come to grips that there is no way to simulate a carriage return in a dos batch file....

with that said, there still is hope. I turned to a new language that is very similar to dos. Give this serious consideration.
it is called AutoIT.
http://www.hiddensoft.com/AutoIt/ (v2 im familiar with)
http://www.autoitscript.com/autoit3/ (just released)

I recommend you look into these links... you still can call dos batch files, but now, you deal with the windows GUI, which you can simulate enters, cancels, radio toggles,etc...

it is a fantastic program, very easy to learn, due to its similarity to dos. Once written in AutoIT you can compile it with one keystroke for anyone to run, or call from another batch file.

i used it to custom software installs without having to lift a finger other than kick off the program.

sounds like to fix your problem it would be a very simple program to write.
hope this helps

RE: simulating enter in a batch file, won't let me pipe a txt file

Thanks ccastelein (loads and loads)

This is a good bit of kit, nice and easy to use, and it will do enter keypress for you.

took me an hour to do my script from install to reading the help to finishing a running script.

Script as follows:

; Script Start - Add your code below here
run ("cmd")
send ("c:")
send ("{ENTER}")
send ("cd\")
send ("{ENTER}")
send ("cd scripts")
send ("{ENTER}")
send ("cd CPbackup")
send ("{ENTER}")
send ("upgrade_export.exe c:\backup")
send ("{ENTER}")
send ("{ENTER}")
send ("exit")
send ("{ENTER}")

Anyone reading this having done a google search for the same sort of problem i had should download this, it even compiles the final result into an exe, and you can call on it in a batch script. Also the help is v.good and helpful, with short tutorials

Thanks again CC..


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close