Arguments

Jun 6, 2012 at 3:14 PM
Edited Jun 6, 2012 at 3:20 PM

Is there a way to launch an exe with an argument or maybe a batch file ?

I was actually trying to launch DesktopInfo which in its default mode (background overlay) doesn't seem to show up but should work with the /f argument to launch it in a window.

I guess another way would be to make a vbs to launch it and convert it to exe but I'd rather avoid that. Of course if anybody has another idea, I'm open to suggestions.

Thanks.

Coordinator
Sep 11, 2012 at 10:28 AM

Hi,

Apologies for the late reply, I didn't realise that the notifications for discussions on this project for me were disabled by default.

Please let me know if this question is still valid, and I will do my best to help you.

Thanks

Nov 29, 2012 at 10:11 AM

I gave up on this idea I had or rather I found another way to achieve what I wanted but I would still be interested to know if it's possible.

Coordinator
Dec 3, 2012 at 3:14 PM

I believe this would be possible if you compiled your own version of the code, and modified the arguments on the CreateProcessAsUser() function.

Probably the easiest thing to do would be to compile your own EXE to call your application with arguments (that's what I would do).

Feb 13, 2013 at 6:26 AM
Hi there,
at first I wanna thank u for posting the code.
Sadly I am not a programmer so I am really lost in it.

The thing is, I am looking for a way to display an installation on the logon screen which has to be done when the user is logged off (thanks to SCCM) which has to be realized without a service but will should be launched by the system user.
Would it be possible to document the main parts of the app?

Thanks
stephan
Coordinator
Feb 13, 2013 at 7:12 PM
You'll only need some basic .NET skills (VB or c#) to to do what you need. You don't have to understand the inner workings of the code to inject a process at the logon screen.

Start a new project, and add a reference to the InjectProcess.dll component from this project. Then you'll only need two lines to launch the process (change as required):
        var ip = new InjectProcess();
        ip.Inject(@"WinSta0\Winlogon", @"C:\Windows\System32\notepad.exe");
Hope this helps.
Feb 14, 2013 at 8:43 AM
Edited Feb 14, 2013 at 11:00 AM
Hi,
thanks for that and the fast answer.
This actually helps me a lot but just facing a problem.
I connect to my machine via RDP and start the system cmd with psexec (-i -s cmd.exe). With some luck I can see on the machine that the notepad opens but after I close it and try to start it again the process notepad.exe just keeps running without being displayed.
Any idea where the process could be hang?
Thx
Stephan

Edit:
It seems for each time I want to execute it I have to wait 5 minutes... :/
Coordinator
Feb 14, 2013 at 6:48 PM
I don't think the notepad.exe process is necessarily hung, rather just not visible. If you do a Ctrl+Tab, does it come to the foreground?
Feb 14, 2013 at 6:52 PM
U r right, its running because I can see the process in the taskmgr but right now I am nor sure if maybe the process is in the backround (I am at home).
In case it is, how can I put it on the top because now I have to wait every time about 5 minutes to start the process again
Coordinator
Feb 14, 2013 at 6:59 PM
If you can launch your process from a Windows Forms application, you could try setting the TopMost property to True before injecting the process.
Feb 14, 2013 at 7:04 PM
I am launching the mshta.exe with a hta file but will try tomorrow if I can get it with Alt+tab.

Btw. is it possible to create a single exe which is running a form on the logon screen without a wrapper?

Btw.2 thanks for your quick respons :) I really appreciate it
Coordinator
Feb 15, 2013 at 8:50 AM
Without trying to overcomplicate this, could you not achieve the same with the following command?

psexec.exe -i -s -x c:\Windows\System32\notepad.exe
Feb 15, 2013 at 5:20 PM
Maybe yes :)
I like to have it complicated. Today I was quite occupied but hopefully I will have more time next week.
I ll keep u updated
Coordinator
Feb 21, 2013 at 5:56 AM
How did you get on with the PsExec command?
Feb 21, 2013 at 3:22 PM
Sorry, still hadnt have the time yet because also we wont use it for what I wanted to have it.
Anyway, when I ll find some spare time, I ll have another look on it