1

I want pass specific parameters(aaa|bbb|ccc) but it's not working.

Here's what the command line looks like:

    test.bat aaa|bbb|ccc

and test.bat looks like:

    echo %1

but its not working cuz test.bat receive only 'aaa'. how can I pass whole parameter 'aaa|bbb|ccc'?

ps. I must use this format : 'aaa|bbb|ccc' there is no option to change like aaa_bbb_ccc.. etc.

javaboy
  • 99
  • 7
  • 5
    Possible duplicate of [How to pass command line parameters to a batch file?](http://stackoverflow.com/questions/26551/how-to-pass-command-line-parameters-to-a-batch-file) – STF Jan 05 '16 at 08:07

2 Answers2

1

Using the "|" means you use the pipe function. http://ss64.com/nt/syntax-redirection.html

You should use "aaa|bbb|ccc" so that it will read everything between the quotation marks.

I hope it helps

1

The VERTICAL BAR is the pipe character to command.com and cmd.exe. If you want to use is literally, it must be escaped using a CARET.

K:>echo aaa^|bbb^|ccc
aaa|bbb|ccc

Actually, I think I might prefer the quoting suggestion as it appears to work under bash and perhaps other shells.

$ echo "aaa|bbb|ccc"
aaa|bbb|ccc

$ echo 'aaa|bbb|ccc'
aaa|bbb|ccc
lit
  • 14,456
  • 10
  • 65
  • 119
  • @user3460334 - Please mark one of the responses as the "Answer." That's how the SO community works. – lit Jan 06 '16 at 13:40