简体   繁体   中英

Execute a system command from C#

My program must be executed immediately after Windows's login screen. For this purpose, I have changed some registry values and now this program launches on start-up instead of Explorer.exe (). In my program, users enter their username and password and then login to system. After login, I want to run explorer.exe, taskbar, and start menu to become visible to user. I use this code to execute system command:

string cmd = "/C explorer.exe ";
System.Diagnostics.Process.Start("CMD.exe", cmd);

But after executing this command, just the My Computer window appears. Taskbar and Start Menu do not appear. How can I see Taskbar and Start Menu after executing the explorer.exe command (I use Windows 7)?

The proper (and only!) way to do customized login is via the Credentials Provider (post Vista) or using Gina (pre-Vista). Read Create Custom Login Experiences With Credential Providers For Windows Vista for an explanation how to do it.

Right now your are just feeding the future columns of Raymond Chen about misbehaving apps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM