Steffan Donal
Steffan Donal

Reputation: 2334

Reopening the taskbar (explorer.exe) after it has been killed?

I'm writing a small program to fix compatibility issues with a 16-bit program. This fix is to close explorer.exe, as explorer overrides some of the palettes in the program. Afterwards, we reopen explorer.

When using a .bat file, it works:

@ECHO OFF
taskkill /f /IM explorer.exe
EmStraditionX.exe
start /B explorer.exe

This method isn't ideal, as it requires extra files to download. For the sakes of simplicity, assume that it is impossible for me to distribute more than the C# compatibility program.

My first thought was to just Process.Start("explorer.exe"), but this did not work, and instead just opened the 'Libraries' folder in an explorer window, without making the taskbar visible again.

I then tried to use the same command as the batch file, except like this: Process.Start("cmd.exe", "/C start /B explorer.exe"), which again did not work.

Does anyone know how I can reopen the taskbar from C#?

Thanks, Ruirize.

Upvotes: 2

Views: 2030

Answers (2)

SmithMart
SmithMart

Reputation: 2801

Use:

Process.Start(Environment.SystemDirectory + "\\..\\explorer.exe");

Putting the full path will make it work

Martyn

Upvotes: 4

Kamil
Kamil

Reputation: 13931

Do you use also "Run As Administrator" function in compatibility options?

If you do - you will start explorer from another session and you cant see window,that is running in other (administrator) session.

Upvotes: 0

Related Questions