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
Error parsing the command-line arguments
Re: Error parsing the command-line arguments
P.S. When running via RUN, everything is fine
https://vgy.me/S2riI8.png
https://vgy.me/S2riI8.png
-
- Posts: 3641
- Joined: Thu May 05, 2011 10:37 pm
Re: Error parsing the command-line arguments
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)
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)
Re: Error parsing the command-line arguments
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%.
@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%.
-
- Posts: 3641
- Joined: Thu May 05, 2011 10:37 pm
Re: Error parsing the command-line arguments
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%.
\" 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%.
-
- Posts: 3641
- Joined: Thu May 05, 2011 10:37 pm
Re: Error parsing the command-line arguments
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)
"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)