#1 2024-09-13 15:02:19

tfopc
Member
Registered: 2024-01-08
Posts: 11

TExecutableCommandLine with own command line

Hi,
is there any function to produce a valid array that can be assigned to cmdline.RawParams to support a CMD-Line like:
prog.exe /switch1 /param="param with spaces" /switch2
My try with:
CsvToRawUtf8DynArray(ownCmdLine,dynArray,' ');
procduces a invalid array because of the spaces in the doublequoted param.

Thanks.

Last edited by tfopc (2024-09-13 15:03:25)

Offline

#2 2024-09-16 08:10:17

tfopc
Member
Registered: 2024-01-08
Posts: 11

Re: TExecutableCommandLine with own command line

I have done it now via an regex found on StackOverflow:

Regex: /[\/-]?((\w+)(?:[=:]("[^"]+"|[^\s"]+))?)(?:\s+|$)/g

With this regex i was able to build the RawUtf8DynArray and assign it on my own ExecutableCommandLine.RawParams before ExecutableCommandLine.Parse(CRLF,'/','-')

Offline

Board footer

Powered by FluxBB