Replace EchoArgs with a CMD script

Topics: Developer Forum
Sep 13, 2007 at 6:27 PM
Would you mind if I replaced the echo args project with the following batch file?

@echo off
if {%1} equ {} goto :eof
echo %1
goto :start
Sep 13, 2007 at 7:14 PM
oh, the batch leetness. looks equally functional to me?
Sep 15, 2007 at 3:51 AM
Except that it doesn't give the correct results:

113> EchoArgs.exe '-t:foo;bar' -foo `"c:\temp`"
Arg 0 is <-t:foo;bar>
Arg 1 is <-foo>
Arg 2 is <c:\temp>

114> .\EchoArgs.cmd '-t:foo;bar' -foo `"c:\temp`"

Notice the double quotes are stripped off the C:\temp arg. Also could you at least make the output look similar to the currently available version?
Sep 15, 2007 at 7:53 PM
The more I think about this the more I do not like it. You are completely at the vagaries of how CMD files handle quotation and parameters. With Echoargs.EXE you are guaranteed to see the parameters exactly how another legacy EXE would see them. Honestly, when something works I don't see much reason to change. Can we put the old echoargs project back into place?

Now if we want to have a separate EchoArgsCmd.cmd to show how a BAT/CMD file receives arguments from PowerShell then I'm all for that.
Sep 15, 2007 at 11:15 PM
Yeah, you're right. CLR seems to parse the arguments the same way like CRT does (which is what probably most command line apps are written in), so I'm going to put the project back.