简体   繁体   English

从C#执行系统命令

[英]Execute a system command from C#

My program must be executed immediately after Windows's login screen. Windows登录屏幕后,必须立即执行我的程序。 For this purpose, I have changed some registry values and now this program launches on start-up instead of Explorer.exe (). 为此,我更改了一些注册表值,现在此程序在启动时启动,而不是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. 登录后,我要运行explorer.exe,任务栏和开始菜单,以使用户可见。 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. 但是执行此命令后,仅出现“ My Computer窗口。 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)? 执行explorer.exe命令(我使用Windows 7)后如何查看任务栏和开始菜单?

The proper (and only!) way to do customized login is via the Credentials Provider (post Vista) or using Gina (pre-Vista). 进行自定义登录的正确方法(也是唯一方法!)是通过Credentials Provider(在Vista之后)或使用Gina(在Vista之前)。 Read Create Custom Login Experiences With Credential Providers For Windows Vista for an explanation how to do it. 阅读有关使用Windows Vista的凭据提供程序创建自定义登录体验的说明,以了解如何执行此操作。

Right now your are just feeding the future columns of Raymond Chen about misbehaving apps. 现在,您只是在为Raymond Chen的未来专栏提供有关错误应用程序的信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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