Error parsing the command-line arguments

User discussion and information resource forum for the TeraByte OS Deployment Tool Suite.
Post Reply
ostapvoip
Posts: 58
Joined: Fri Feb 08, 2013 10:32 pm

Error parsing the command-line arguments

Post by ostapvoip »

Hello,
A simple TBS script

sub main()
for i = 1 to argc()
printl("Arg" # (i) # "=" # arg(i))
next
end sub

Result and incorrect result https://vgy.me/ykg5GQ.png
ostapvoip
Posts: 58
Joined: Fri Feb 08, 2013 10:32 pm

Re: Error parsing the command-line arguments

Post by ostapvoip »

P.S. When running via RUN, everything is fine
https://vgy.me/S2riI8.png
TeraByte Support
Posts: 3596
Joined: Thu May 05, 2011 10:37 pm

Re: Error parsing the command-line arguments

Post by TeraByte Support »

the command terminal / prompt your using uses \ as an escape character to
say return the actual quote. So I believe you'd need to use \\" tell it to
treat the next \ as an actual \

"ostapvoip" wrote in message news:15611@public.tbosdt...

Hello,
A simple TBS script

sub main()
for i = 1 to argc()
printl("Arg" # (i) # "=" # arg(i))
next
end sub

Result and incorrect result

[
https://vgy.me/ykg5GQ.png
](https://vgy.me/ykg5GQ.png)


ostapvoip
Posts: 58
Joined: Fri Feb 08, 2013 10:32 pm

Re: Error parsing the command-line arguments

Post by ostapvoip »

Added test

@echo off
:beginParseParams
if /i "%~1"=="" goto :endParseParams
echo %1
shift & goto :beginParseParams
:endParseParams

That is it is normal?
https://vgy.me/9jdtFU.png

And in my opinion it is an parsing error. 100%.
TeraByte Support
Posts: 3596
Joined: Thu May 05, 2011 10:37 pm

Re: Error parsing the command-line arguments

Post by TeraByte Support »

yes, it's normal. When you pass the parameters from the command prompt the
\" will escape the " to be a " and not the end of quoted string.

You can proves this by just setting up a run parameter

exec testit.exe "testing\" /123

You'll see it's:
testing\ /123

because cmd.exe didn't process the command line. Where as from cmd.exe it
will be:

testing" /123

You have the same type of issue with terminal / bash in linux.


"ostapvoip" wrote in message news:15616@public.tbosdt...

Added test

@echo off
:beginParseParams
if /i "%~1"=="" goto :endParseParams
echo %1
shift & goto :beginParseParams
:endParseParams

That is it is normal?

[
https://vgy.me/9jdtFU.png
](https://vgy.me/9jdtFU.png)

And in my opinion it is an parsing error. 100%.

ostapvoip
Posts: 58
Joined: Fri Feb 08, 2013 10:32 pm

Re: Error parsing the command-line arguments

Post by ostapvoip »

OK.
But why arguments in the RUN do not work like that? This is strange.
https://vgy.me/S2riI8.png
TeraByte Support
Posts: 3596
Joined: Thu May 05, 2011 10:37 pm

Re: Error parsing the command-line arguments

Post by TeraByte Support »

because the command line is not be processed by cmd.exe


"ostapvoip" wrote in message news:15635@public.tbosdt...

OK.
But why arguments in the RUN do not work like that? This is strange.

[
https://vgy.me/S2riI8.png
](https://vgy.me/S2riI8.png)


Post Reply