flat assembler
Message board for the users of flat assembler.

Index > High Level Languages > Creating a Simple Scripting Language.

Author
Thread Post new topic Reply to topic
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Tyler 22 Dec 2009, 23:59
I can do all the language making related stuff, I just need to know how to get the path to a file when a file set to be opened by my program is double clicked. Example: When you click a ".bat", cmd automatically knows the path to the .bat, how? Would the path to the file to be opened be in argv?
Post 22 Dec 2009, 23:59
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20290
Location: In your JS exploiting you and your system
revolution 23 Dec 2009, 00:04
Just pass the whole path to cmd.
Code:
cmd c:\myStuff\CommandLineThingies\Batchypoos\GreatShit\SolveAllTheWorldsProblems.bat    
Post 23 Dec 2009, 00:04
View user's profile Send private message Visit poster's website Reply with quote
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Tyler 23 Dec 2009, 00:19
No, I mean what does Windows send to a program(cmd in the example). I need to know how cmd receives the path(when a .bat is clicked and Windows opens cmd because cmd is associated with .bats). I am looking into how hard it would be to make a program that would be in the role of cmd in the example. I want it to be able to run scripts, as well as typed commands.
Post 23 Dec 2009, 00:19
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4016
Location: vpcmpistri
bitRAKE 23 Dec 2009, 01:11
Windows passes the commandline to the program defined in the registry. Then the application uses the GetCommandline (or others) API.
Post 23 Dec 2009, 01:11
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20290
Location: In your JS exploiting you and your system
revolution 23 Dec 2009, 01:21
Tyler wrote:
No, I mean what does Windows send to a program(cmd in the example). I need to know how cmd receives the path(when a .bat is clicked and Windows opens cmd because cmd is associated with .bats). I am looking into how hard it would be to make a program that would be in the role of cmd in the example. I want it to be able to run scripts, as well as typed commands.
Windows sends the entire path, just like I typed above. Else there is no way for the invoked cmd to know where the batch file is.
Post 23 Dec 2009, 01:21
View user's profile Send private message Visit poster's website Reply with quote
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Tyler 23 Dec 2009, 04:25
Thanks, I should have got it from revolution's first reply, but wasn't sure how Windows passes arguments when the args are generated by GUI. Anyway, the path to the file is in argv[1].
Post 23 Dec 2009, 04:25
View user's profile Send private message Reply with quote
roboman



Joined: 03 Dec 2006
Posts: 122
Location: USA
roboman 23 Dec 2009, 04:26
If you right click on a desktop icon or file and then go down and click on properties you will see what info windows has on where the file is. The rest, as pointed out above is in the registery. I may be wrong, but I think you can also define paths, just like in dos, if it's Win 95, 98 or ME.
Post 23 Dec 2009, 04:26
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.