Questions

cleanly stop and restart explorer.exe

+
0 Votes
Locked

cleanly stop and restart explorer.exe

Locrian_Lyric
Hi, I need to cleanly stop, then restart explorer. I have some older programs which conflict with explorer in windows 7.

Currently, I am doing this with .bat files like this:

cd C:\windows\system32
TASKKILL /F /IM "explorer.exe"
cd C:\"Program Files (x86)"\OldPrograms
start /w C:\"Program Files (x86)"\OldPrograms\Prog1.exe
cd c:\
start C:\Windows\explorer.exe

The problem is that this is getting annoying and I have several. Is there a way to do this through code? Preferably VB? I'm putting together an application that will let me choose which program to run, then disable explorer, then enable it upon termination of the program I am running.

Any help would be greatly appreciated.
  • +
    0 Votes
    gechurch

    It sounds like you just want to be able to pass in the name/path of the program to run to a generic program you write. Is this correct, or do you also want to create a GUI that lets the user select the program to run?

    If it's the former then that's easy. You can re-code your batch file to take in the program path as a variable if you like. You can do the same thing in other languages too. Most languages will have a bunch of process calls like ProcessKill or ProcessClose. The documentation for whichever language you choose will show you how to do this. You shouldn't expect random TechRepublic members to do your homework for you when you can do it just as easily yourself. If your language happens not to have such a function then you can call Taskkill just like your batch file does.

    +
    0 Votes
    Locrian_Lyric

    Well, that was a nice steaming pile of condescending BS.

    Next time someone asks for help, just ignore them because this was less than nothing. by the way, run my name through the search feature here and you'll find I'm hardly a kid looking for help.

    +
    0 Votes
    Locrian_Lyric

    Furthermore, Process.kill doesn't work because explorer starts right up again. Ditto that with thte close command.

    What I have works, but it's annoying, but thanks for being a jerk.

    +
    0 Votes
    gechurch

    I didn't think you were a kid (I didn't intend the word 'homework' literally - I used it to mean 'research that needs to be done'). I did, though, find your question to be ambiguous and unclear, and your current idea of producing a new batch file with a hard-coded path for each program is not the sort of thing a seasoned pro like yourself would do. You could have saved both our time by mentioning the fact that you have already tried ProcessKill and stating why it wasn't suitable for your needs.

    You still haven't clarified exactly what it is you are trying to achieve. What is wrong with one of my suggestions of passing in the path as a command line paramater? Why doesn't that meet your need? And what about the idea of calling taskkill from your language of choice? If that doesn't solve your problem, then explain to us why not. If you can't clearly elicit your requirements, how on earth are we supposed to provide answers that are to your satisfaction? Until the human race perfects mind-reading, we have to rely on clear and concise communication.

    I do apologise that the free advice I spent my time providing was not acceptable to Your Worship. I wish you the best of luck in finding someone else that will waste their time trying to help you for the privilege of being called a jerk.

    +
    0 Votes
    Locrian_Lyric

    Your free advice was worth less than what I paid for it.

    +
    0 Votes
    pdqtechnology

    So, If I make a comment, I can expect to get **** from his highness Loran_clueless?

    +
    0 Votes
    pdqtechnology

    Things have changed in the last five to ten years. I would listen to what gechuch recommends. And remember that us brain injured folks tend to get angry easy and sometimes need to back off and remember that some one is trying to help and not looking for crap.

    +
    0 Votes
    Locrian_Lyric

    pdq, you may simply refer to me as "Lord and master"

    +
    2 Votes
    Slayer_

    That one has me confused.

    +
    0 Votes
    Locrian_Lyric

    The programs I am using are older programs, back to the 1990s. When I disable explorer, either through a .bat file I set up, or by using the command line interface, the problem goes away.

    While these programs run without disabling explorer (with some system tweaking), they are useless because the color scheme gets distorted to the point of them being illegible and therefore useless.

    I posted the example of the .bat file to demonstrate what I needed, and yes it is confusing. I've tried process.kill and other programmatic attempts to shut down explorer during the duration of the run, but explorer keeps getting kicked back on.

    +
    0 Votes
    Slayer_

    Does setting compatibility mode on the exe to 256 colours help?

    Have you tried the MS compatibility tools?
    http://www.microsoft. com/en-ca/download/details.aspx?id=7352
    Remove the space to make the link work. I think that's the right program. I haven't had to use it in ages. Last time I used it was to disable the auto UAC prompt on an exe.

  • +
    0 Votes
    gechurch

    It sounds like you just want to be able to pass in the name/path of the program to run to a generic program you write. Is this correct, or do you also want to create a GUI that lets the user select the program to run?

    If it's the former then that's easy. You can re-code your batch file to take in the program path as a variable if you like. You can do the same thing in other languages too. Most languages will have a bunch of process calls like ProcessKill or ProcessClose. The documentation for whichever language you choose will show you how to do this. You shouldn't expect random TechRepublic members to do your homework for you when you can do it just as easily yourself. If your language happens not to have such a function then you can call Taskkill just like your batch file does.

    +
    0 Votes
    Locrian_Lyric

    Well, that was a nice steaming pile of condescending BS.

    Next time someone asks for help, just ignore them because this was less than nothing. by the way, run my name through the search feature here and you'll find I'm hardly a kid looking for help.

    +
    0 Votes
    Locrian_Lyric

    Furthermore, Process.kill doesn't work because explorer starts right up again. Ditto that with thte close command.

    What I have works, but it's annoying, but thanks for being a jerk.

    +
    0 Votes
    gechurch

    I didn't think you were a kid (I didn't intend the word 'homework' literally - I used it to mean 'research that needs to be done'). I did, though, find your question to be ambiguous and unclear, and your current idea of producing a new batch file with a hard-coded path for each program is not the sort of thing a seasoned pro like yourself would do. You could have saved both our time by mentioning the fact that you have already tried ProcessKill and stating why it wasn't suitable for your needs.

    You still haven't clarified exactly what it is you are trying to achieve. What is wrong with one of my suggestions of passing in the path as a command line paramater? Why doesn't that meet your need? And what about the idea of calling taskkill from your language of choice? If that doesn't solve your problem, then explain to us why not. If you can't clearly elicit your requirements, how on earth are we supposed to provide answers that are to your satisfaction? Until the human race perfects mind-reading, we have to rely on clear and concise communication.

    I do apologise that the free advice I spent my time providing was not acceptable to Your Worship. I wish you the best of luck in finding someone else that will waste their time trying to help you for the privilege of being called a jerk.

    +
    0 Votes
    Locrian_Lyric

    Your free advice was worth less than what I paid for it.

    +
    0 Votes
    pdqtechnology

    So, If I make a comment, I can expect to get **** from his highness Loran_clueless?

    +
    0 Votes
    pdqtechnology

    Things have changed in the last five to ten years. I would listen to what gechuch recommends. And remember that us brain injured folks tend to get angry easy and sometimes need to back off and remember that some one is trying to help and not looking for crap.

    +
    0 Votes
    Locrian_Lyric

    pdq, you may simply refer to me as "Lord and master"

    +
    2 Votes
    Slayer_

    That one has me confused.

    +
    0 Votes
    Locrian_Lyric

    The programs I am using are older programs, back to the 1990s. When I disable explorer, either through a .bat file I set up, or by using the command line interface, the problem goes away.

    While these programs run without disabling explorer (with some system tweaking), they are useless because the color scheme gets distorted to the point of them being illegible and therefore useless.

    I posted the example of the .bat file to demonstrate what I needed, and yes it is confusing. I've tried process.kill and other programmatic attempts to shut down explorer during the duration of the run, but explorer keeps getting kicked back on.

    +
    0 Votes
    Slayer_

    Does setting compatibility mode on the exe to 256 colours help?

    Have you tried the MS compatibility tools?
    http://www.microsoft. com/en-ca/download/details.aspx?id=7352
    Remove the space to make the link work. I think that's the right program. I haven't had to use it in ages. Last time I used it was to disable the auto UAC prompt on an exe.