windows - Passing parameters to a batch file that end in a numeral -
i have requirement pass arguments string 1 batch file execution @ command line. have batch file takes arguments (i.e. command "tail") , creates batch file executes arguments. consider file batch1.bat:
echo %*>batch2.bat call batch2.bat if run with
batch1.bat echo b c we get
a b c which fine. if run with
batch1.bat echo 1 2 3 we get
1 2 i guess because last argument 3 gets interpreted batch operator following > redirection character. know simple fix add space, in
echo %* >batch2.bat but there occasions when command line cannot have trailing space, like:
batch1 set noenv= will give environment variable value of 1 space character, instead of deleting environment variable.
so how do this? - requirement have batch file faithfully executes command tail (which might include items in quotes, numerals)
move redirect front of statement.
>batch2.bat echo %*
Comments
Post a Comment