Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
CSS
I have a script is to run to check the error which is needed to manual select the 0 to proceed.

I need to run the LFNReport.exe to scan the error line inside the permission_data.txt, but i need it to run auto and select 0 by automatically.

if manual run for the LFNReport.exe i need to double click the exe and select 0 and press enter to execute and then press enter again to quit the apps.

mkdir logFile\%date:~12,4%%date:~4,2%%date:~7,2%
copy LFNReport.exe logFile\%date:~12,4%%date:~4,2%%date:~7,2%
move permission_data.txt logFile\%date:~12,4%%date:~4,2%%date:~7,2%
CALL LFNReport.exe echo 0 logFile\%date:~12,4%%date:~4,2%%date:~7,2%


appreciated someone can or provide me the appropriate batch script for the last line to execute the 0 with automatic?
Posted

Remove "CALL", it is used with other batch files, not program. Alternatively, use "start LFNReport.exe".
In first case, the batch waits for process, in second case, it continues execution in parallel.

—SA
 
Share this answer
 
If your goal is to send a character to the LFNReport.exe program (I suppose it is a Console program), you may try the following syntax in the command line:
LFNReport.exe args < response.txt


response.txt is a file containing the characters you want to send to the application, in your case:
0
should be enough.

For a Windows program, you may use a Windows Script File, when the program is started, you can use the Sendkeys method to send the characters.
More details on Windows Scripting Host here: http://msdn.microsoft.com/en-us/library/98591fh7(v=vs.84).aspx[^]
 
Share this answer
 
v2
Comments
LeeCooper2288 21-Oct-13 22:38pm    
mkdir logFile\%date:~12,4%%date:~4,2%%date:~7,2%
copy Response.txt logFile\%date:~12,4%%date:~4,2%%date:~7,2%
copy LFNReport.exe logFile\%date:~12,4%%date:~4,2%%date:~7,2%
copy Exit.txt logFile\%date:~12,4%%date:~4,2%%date:~7,2%
move permission_data.txt logFile\%date:~12,4%%date:~4,2%%date:~7,2%
LFNReport.exe args < Response.txt logFile\%date:~12,4%%date:~4,2%%date:~7,2%
LFNReport.exe args < Exit.txt logFile\%date:~12,4%%date:~4,2%%date:~7,2%


Hi Pascal-78 Many thanks for your helps on this, "LFNReport.exe args < Response.txt" is worked for me, but i need it to run in the (logFile\%date:~12,4%%date:~4,2%%date:~7,2%) directory because since all files has been moved into that location and i hope the console program finish the program run and it will exit from the console program, if i need to exit it, i would need to manual insert the x and it will only exit the console program. but i need it to be automatically. appreciated if you Could you help on this ?
Pascal-78 22-Oct-13 5:27am    
You should put the path before the file name. I would recommend to store the path in a variable:
SET mydir=logfile\%date:~12,4%%date:~4,2%%date:~7,2%
mkdir %mydir%
copy response.txt %mydir%
copy LFNReport.Exe %mydir%
move permission_data.txt %mydir%
cd %mydir%
LFNReport.exe < response.txt

or %mydir%\LFNReport.exe < %mydir%\response.txt
LeeCooper2288 22-Oct-13 9:09am    
Hi Pascal-78, thanks again for your kind help, last question , i would need to set the the "exit" the LFNReport.exe by automatic, how do i put the command for it to exit the program without needed manual click for x to execute exit?
Pascal-78 23-Oct-13 4:34am    
by click x, do you mean click on the close button of the window ?
In this case, the console program should be closed when the program finished.
If not, you may have an old option "Close on exit" not checked.
How do you start the LFNReport program? using start? using cmd? or directly the program?
I think you should use directly the program (without start or cmd).
LeeCooper2288 23-Oct-13 0:06am    
Any one know the answer? in the response.txt, after sent the character and move the file to the directory, the CMD.exe for LFNReport.exe was not able to exit automatically.

0
move LFN - MergedReport.txt %mydir%
exit

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900