Page 1 of 1

Command Line Arguments Example

Posted: Thu May 11, 2023 2:12 am
by Taishan
Hi gang

New to PB - coming from VB and C++.

How can I pass command line arguments to a PB program compiled as a console, or non-GUI exe, platform independent (I can figure out Mac and Linux) from here:

"C:\Program Files\xyz.exe 4, 5, D:\abc.ini, D:\cba.txt"

The first command line argument is "4", the second is "5".

The PB procedure performs addition (arg 1+ arg 2)

and the last argument is the "new file path" to save the renamed/output of the procedure.

Winner for least lines of code wins! haha

Cheers
Tai

Re: Command Line Arguments Example

Posted: Thu May 11, 2023 2:17 am
by jassing
ProgramParameter()

Re: Command Line Arguments Example

Posted: Thu May 11, 2023 2:24 pm
by Quin
CountProgramParameters() to get the count and validate that it's correct, and ProgramParameter(Index) to get the parameter at each index. You can find both these functions under the Process section of the library documentation :)

Re: Command Line Arguments Example

Posted: Thu May 11, 2023 8:17 pm
by Taishan
Thanks jassing and Quin. Glad to see programmers with a sense of humor! :D