flat assembler
Message board for the users of flat assembler.

Index > Windows > how right get arguments from bat file ?

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 2039
Roman 22 Dec 2025, 11:59
I have bat file.
Code:
;in bat file
myprog.exe name1,name2,10     


I want get "name1,name2,10" in my program. How do this ?
I know GetCommandLineA. Its help me or not ?
Post 22 Dec 2025, 11:59
View user's profile Send private message Reply with quote
Ali.Z



Joined: 08 Jan 2018
Posts: 844
Ali.Z 22 Dec 2025, 12:23
yes pretty much, but keep in mind Windows arg style is space delimited,
you could convert it to C style by you using CommandLineToArgvW.

or directly get argc and argv from msvcrt. (thats what I do)

_________________
Asm For Wise Humans
Post 22 Dec 2025, 12:23
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20804
Location: In your JS exploiting you and your system
revolution 23 Dec 2025, 00:44
If comma (,) is the separator then the custom code need to parse the raw output from GetCommandLine{A|W}.

If a space ( ) is the separator then lots of existing code can parse the raw output from GetCommandLine{A|W} and produce a list of parameters/arguments.

Either way, the primary source of arguments is GetCommandLine{A|W}. Using the "W" version will allow for better support for internationalisation with non-ASCII characters.

Internally Windows uses "wide" chars everywhere, and using an "A" version API incurs a conversion overhead each time an "A" API is called.
Post 23 Dec 2025, 00:44
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.