try :
myexe.exe ">" "senod param"
in your batch
Main Topics
Browse All Topicsmy program needs to read command line parameters.
So i am using paramstr to get the values , however i have a small problem when command line contains the character > or |
This problem only comes when i call my program though a batch file , if i type the same command through START-RUN option then it works fine.
anything after those characters is lost
example if command line is
myexe.exe hello there
then program reads hello there correctly
however if it is
myexe.exe hello > there
then program reads only hello , it seems it looses > there
can anyone help me with this one ?I want to get entire command line
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
hi guys,
actually i am trying to make a small program that will replace an old program .
now the old program is used in hundreds of batchfiles and strangely it works fine with those characters.
am not sure what that program is made in ,maybe C++ .
so was just wondering if that program works without using " ,how come my program cannot detect those characters.
am only trying to avoid changing all those batchfiles.
thank you for your help so far
If you send a commandline to it from a batch file with > characters in then it will redirect output to the filename after that, period. Could it be that the old program isn't reading that parameter but is actually just outputting to the console and the > whatever is creating a file called whatever that is then used somewhere else?
If you understand all about redirection using > < >> << | 2> 2>> etc. then sorry, ask if you want to know more!
as dragon-it posted > redirects program out and you can't help it and there's no magic in it it doesn't matter if it was written in c or in any other language
try this:
program Project1;
begin
Reset(Output);
WriteLn(OutPut, 'hello world');
end.
and then run in from command line: Project1.exe > test.txt
it will create test.txt file and put single line "hello world" in it.
ziolko.
Hi guys ,
thanks once again for spending time to help me.
I understand what you guys are trying to say but there is one thing wrong with what you are saying.
if i have a batch file and I put something like
myexe.exe hello > afirstfile.txt
myexe.exe hello > asecondfile.txt
there is no way the program can redirect data to afirstfile.txt and then read it because it just cant read anything after > so it does not know which file to redirect to and then read ,which is the exact problem i am stuck with.
I hope I am not confusing you guys
Thank you once again for your valuable time
http://www.experts-exchang
Most of the characters are readable if you first surround them with double quotes:
Prog.bat "C:\File.txt"
Bat.cmd "Program.exe/s MyFile.dat > Output.txt"
Everything inside of the quotes is a part of the same argument and can be passed as a complete string
> myexe.exe hello > there
the word "there" is translated into the filename for your output via redirection
> it seems it looses > there
not lost, it is interpreted for you for execution
just in case this helps ,
the freeware program i am trying to imitate is here
http://www.softpedia.com/g
it works with > in batch files , very amazing indeed
>>there is no way the program can redirect data to afirstfile.txt and then read it because it just cant read anything after >
see my example again, can you see there somwhere checking params or lookng for file name?
>>the freeware program i am trying to imitate is here
didn't download file well I think I don't have to....
"(...)Example:
Winput "SET Name=$input" "Please enter your name" > temp.bat
if not errorlevel 1 call temp.bat
This will send a set statement to the file temp.bat,(...)"
as you can see here's everything we told you, you have parameters in quotes and REDIRECTED output to temp.bat "This will send a set statement to the file temp.bat"
ziolko.
Business Accounts
Answer for Membership
by: developmentguruPosted on 2008-02-08 at 10:34:42ID: 20852701
You will likely need to surround your parameters in quotes due to the fact that the symbols that are causing you problems are piping symbols used to redirect the output of your program. Put the parameters in quotes and it should ignore those symbols.