About console parameters

Just starting out? Need help? Post your questions and find answers here.
thyr0x1ne
User
User
Posts: 18
Joined: Sat Feb 14, 2004 11:38 pm

About console parameters

Post by thyr0x1ne »

I did a try on PureBasic after a webpages relating articles ... thought libraries quite nice , ressources ... well a powerful langage for hard-coders , and a sweet one for beginners like i am :) thats why for now i prefer keep the free demo.

Btw i was searching for this : can i set parameters in my command line ?
( ex : file.exe -n NAME -r REALNAME )

where -n / -r are flags , and NAME and REALNAME values i could enter with a console application ...

I take a look on RunProgram , and ProgramParameters , but was not able to do sth ... so if you can give me a hand , feel free :) i just hope i will be able to do this without API as my version seems not support them.

Wish you all a nice week end:

thyr0x
Proteus
Enthusiast
Enthusiast
Posts: 113
Joined: Wed Sep 17, 2003 8:04 pm
Location: The Netherlands

Post by Proteus »

I haven't tested it, but this should work.

Code: Select all

Repeat
  Param.s = ProgramParameter()
  Select LCase(Param)
    Case "-n" : NAME.s = ProgramParameter()
    Case "-r" : REALNAME.s = ProgramParameter()
  EndSelect
Until Param = ""
P4 2.4GHz, 256 MB, WinXP Pro, onboard video&audio.
The Programmer's Drinking Song:
"99 little bugs in the code,
99 little bugs.
Fix one bug, recompile
100 little bugs in the code."
thyr0x1ne
User
User
Posts: 18
Joined: Sat Feb 14, 2004 11:38 pm

Post by thyr0x1ne »

will try this tomorrow .
many thanks for this quick reply ... just had the time to get a drink :)
thyr0x1ne
User
User
Posts: 18
Joined: Sat Feb 14, 2004 11:38 pm

Post by thyr0x1ne »

seems it dont work ... or most probably i do it bad :
will try tomorrow to parse parameters with spaces and check for the good syntax
Proteus
Enthusiast
Enthusiast
Posts: 113
Joined: Wed Sep 17, 2003 8:04 pm
Location: The Netherlands

Post by Proteus »

Parameters with spaces should be surrounded in quotes. Like this:
-n Proteus -r "not putting my real name on the Internet"

It works fine here.
P4 2.4GHz, 256 MB, WinXP Pro, onboard video&audio.
The Programmer's Drinking Song:
"99 little bugs in the code,
99 little bugs.
Fix one bug, recompile
100 little bugs in the code."
thyr0x1ne
User
User
Posts: 18
Joined: Sat Feb 14, 2004 11:38 pm

Post by thyr0x1ne »

really thanks , it works perfectly
Post Reply