Brian Frost
Brian Frost

Reputation: 13454

How to pass command-line args to my application when it has replaced Explorer.exe

I am using the techinque shown here and in a number of other places to cause my application to launch at start-up in place of Explorer (and Metro in Windows 8!) by creating a registry key

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\Shell

with c:\xxxxx\MyApp.exe as the argument.

This works fine but I also need to pass it some arguments. I've tried this by making my key value (for example) "c:\xxxx\MyApp.exe" "arg1, arg2" but it would appear that arguments are being taken as a possible second start-up program with the comma as a delimiter. Can anyone advise how to pass arguments to a shell substitute? I've also tried double quotes with the same effect. Is it actually possible to pass arguments in this way? Or must I create some kind of launcher app to do this indirectly? I really do want my app to be the only kid on the block....

BTW I'm using Windows 8.0 and my app is written in Delphi.

Upvotes: 2

Views: 1027

Answers (1)

Ken White
Ken White

Reputation: 125728

AFAIK, you'd use the parameters just like you would in a batch file:

 "C:\xxxxx\MyApp.exe" "%1" "%2" "%3" "%4" "%5"

In a batch (or the registry) the "%x" parameters have special meaning. They always mean "parameter X".

Upvotes: 2

Related Questions