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
(OP)
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
Thanks
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
Thanks

Talk To Other Members
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
ccastelein
RE: simulating enter in a batch file, won't let me pipe a txt file
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")
Sleep(500)
send ("c:")
Sleep(500)
send ("{ENTER}")
Sleep(500)
send ("cd\")
Sleep(500)
send ("{ENTER}")
Sleep(500)
send ("cd scripts")
Sleep(500)
send ("{ENTER}")
Sleep(500)
send ("cd CPbackup")
Sleep(500)
send ("{ENTER}")
Sleep(500)
send ("upgrade_export.exe c:\backup")
Sleep(500)
send ("{ENTER}")
Sleep(1000)
send ("{ENTER}")
Sleep(30000)
send ("exit")
Sleep(500)
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..
wibblewobblewow