how do i start explorer using process class in c#

2019-08-17 03:01发布

问题:

i have replaced windows shell with my application it worked perfectly, after closing my application i have to launch windows explorer with the following piece of code

Code to start explorer

Process.Start(@"c:\windows\explorer.exe");

Registry key i have used to replace shell

HKEY_Local_Machine\Software\Microsoft\WindowsNT\CurrentVersion\WinLogon\Shell 

it doesnt show taskbar and start menu, it just shows mydocuments folder. I need start menu and taskbar while after explorer started

回答1:

My guess is that since explorer isn't defined as the shell, it won't run as the shell. I think that you'd have to change the registry settings to make explorer the shell again before you run it.



回答2:

So, as you wrote you replaced the shell in the registry with your own version. So it's up to you to show a start menu, etc. If you like to start a explorer and let it act as a shell, go on and replace the entry in the registry with the old one.

Due to the fact, that you like to be the shell again, next time windows starts, maybe the following trick will do it:

Prerequisities:

  • Place your program in registry as shell and start windows
  • Your program runs and wants to start explorer as shell

Action to to:

  1. Replace entry in registry against entry containing explorer as shell
  2. Start the explorer
  3. Replace entry in registry back to your app as shell programm
  4. Wait till next boot...


回答3:

You will probably have to kill the existing shell process (i.e. your app) before starting explorer again.