Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi,
I've made a batch script which has a list of commands to do. One of them is to close explorer.exe which it says access denied to... but it works anyway lol. Only problem is now it ignores my exit command at the end of the batch and the window doesnt close... how can i force it to close?
Thanks =]

DrunkenSensei91,
You did not mention the OS you are running.
I presume it is XP or lower.
I think you just need to click on the system menu at left top of command window and chose "close on exit" somewhere....
I think you can do the same by right clicking on the batch file's icon too; I am not too sure.I have Vista now and cant check this now as they have removed it in Vista.
--
Holla.

Dear DrunkenSense,
I have read somewhere saying if your command prompt does not have anything on display, windows closes it, regardless of the setting of "close on exit". Try adding this at the end of the batch file:
@Echo Off
CLS--
Holla.

Windows XP yes. I don't want to have to click the properties of command prompt or anything, i need it to be an automated thing because i will be distributing this amongst peers of a network. I tried adding @echo off and cls to the batch but it didn't close the window, it still said "End process failed for explorer: Access is denied." But it actually ends explorer and ignores my exit command...?

What command are you using to close Explorer? Can you show us this command up to the end of your batch file where you call exit?
"But it actually ends explorer and ignores my exit command" -- I bet it doesn't actually end the process. Just because the Explorer windows disappear, doesn't mean the process has ended. Does it show in the Processes tab in Task Manager?

@ECHO OFF
tskill explorer
cd %windir%
explorer.exe
cls
exitI know this script looks weird as hell to you all but it has a purpose which works perfectly fine... just leaves behind the access denied. If i don't re run explorer like i do in that script it will do it itself but i do it to get it done quicker.

Aha! There you are, you've called explorer.exe which makes your batch file pause until explorer.exe exits...
You need to say START explorer.exe. Then your batch file will carry on until it exits.

By the way, I've just noticed another problem. When you call explorer.exe, presumably to start a new explorer process, it notices that there is already an explorer process running (it's the one that's in the process of getting killed, but the new process doesn't know that.)
The default behaviour for explorer is to hand over control to an existing explorer process. So your new explorer process tries to hand over control to the dying process, which may get a bit tricky, and may be the reason you are getting that weird error message. I would say the best thing is NOT to re-start explorer, but to let it restart itself. It will re-start once the old process has completely died, which is the cleanest thing to do, and which takes a little more time.

This is the only way my script works... i know it sounds weird but for what i'm having it do it will only work this way. Can i stop it from pausing or whatever? The application is working perfectly i just need to remove the command prompt after it finishes the commands automatically... Instead of hanging on the screen. Help please?

As per my earlier post, to stop it from pausing put this:
START explorer.exe
instead of:
explorer.exe

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |