May 29, 2007 at 8:26 am
Hi,
I want to pass parameters to an exe thru a batch file.
Can anyone give me the syntax.
My exe(parser.exe) parses text files and needs folder path as input parameter.
I tried :
parser.exe "D:"
but it didnt work.
Any replies would b appreciated.
Thanks
Pankaj
May 29, 2007 at 10:38 am
A little more information on the environment would be useful, but from what you have posted I have a suggestion.
I made a batch file that opens notepad.exe and passes a text file to it, the format of the batch file was:
notepad.exe test_batch_file.txt
No quotes are needed, I believe, unless there are spaces in the name or there are reserved characters in the name (e.g. |)
May 30, 2007 at 9:07 am
Assuming a Windows/DOS Shell environment:
Did you write the code for the .exe? if not, there may be some syntax to tell it which parameter you are trying to send. i.e., if your program is called "parser.exe" and you need to pass it a file name, you may need to type:
parser /F filename.txt
Or similar. the forward slash is common, the letters after it can be case-specific, and capitol F is just one i made up. the real parameters should be specified in documentation/help files that came with the exe (if you have any). the above will look in the current directory for "filename.txt", so if that file and the parser.exe file are not in the same directory then you will have to specify the path to the one not in your current directory.
if you did write the .exe yourself, probably the syntax Shawn described above is what you need - just list your parameters in the order that your program is expecting them.
parser parameter1 parameter2 "parameter 3"
Last suggestion, if you are specifying a location (ie the root of the D: drive) you may need to specify D:\ instead of just D:.
Hope this helps
~ casey
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply