Batch file executed at startup

  • Thread starter Thread starter Trevor L.
  • Start date Start date
T

Trevor L.

This is a simple question.

I have a folder which I can't delete as it is in use - I find explorer.exe
has it. I can't close explorer as then I want have access to the folder to
delete it

I therefore want to execute a file at start-up to do the deletion
The contents would be:
rmdir C:\Documents and Settings\Trevor\My Documents\My Webs\oldzip /Q

Where do I put this code?
Is it autoexec.bat ?
Or what?
 
Logon as another user then delete.

--

Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

:
| This is a simple question.
|
| I have a folder which I can't delete as it is in use - I find explorer.exe
| has it. I can't close explorer as then I want have access to the folder to
| delete it
|
| I therefore want to execute a file at start-up to do the deletion
| The contents would be:
| rmdir C:\Documents and Settings\Trevor\My Documents\My Webs\oldzip /Q
|
| Where do I put this code?
| Is it autoexec.bat ?
| Or what?
| --
| Cheers,
| Trevor L.
| Website: http://tandcl.homemail.com.au
|
|
 
[[Deleting the current directory
You cannot use rmdir to delete the current directory. You must first change
to a different directory (not a subdirectory of the current directory) and
then use rmdir with a path. If you attempt to delete the current directory,
the following message appears:

The process cannot access the file because it is being used by another
process.]]
Rmdir (rd)
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/rmdir.mspx

Kill explorer.exe and use the command prompt to delete the folder.

Open the Task Manager...
Ctrl + Shift + Escape | Click on the Processes tab | Locate and highlight
explorer.exe | Right click explorer.exe | Click End Process | Click
Yes to the Task Manager Warning that pops up | File | New | CTRL key + click
New Task (Run...)

Then type or paste into the command prompt:
rmdir C:\Documents and Settings\Trevor\My Documents\My Webs\oldzip /Q

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
 
Wesley said:
[[Deleting the current directory
You cannot use rmdir to delete the current directory. You must first
change to a different directory (not a subdirectory of the current
directory) and then use rmdir with a path. If you attempt to delete
the current directory, the following message appears:

The process cannot access the file because it is being used by another
process.]]
Rmdir (rd)
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/rmdir.mspx

Kill explorer.exe and use the command prompt to delete the folder.

Open the Task Manager...
Ctrl + Shift + Escape | Click on the Processes tab | Locate and
highlight explorer.exe | Right click explorer.exe | Click End Process
| Click
Yes to the Task Manager Warning that pops up | File | New | CTRL key
+ click New Task (Run...)

Then type or paste into the command prompt:
rmdir C:\Documents and Settings\Trevor\My Documents\My Webs\oldzip /Q

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
Trevor L. said:
This is a simple question.

I have a folder which I can't delete as it is in use - I find
explorer.exe has it. I can't close explorer as then I want have
access to the folder to delete it

I therefore want to execute a file at start-up to do the deletion
The contents would be:
rmdir C:\Documents and Settings\Trevor\My Documents\My Webs\oldzip /Q

Where do I put this code?
Is it autoexec.bat ?
Or what?

Thanks, Wesley.

I knew that I could kill explorer.exe, but then I didn't know how to get to
the command prompt as all the icons etc, are removed. I think you are saying
that I can get to it from the Task Manager.

Luckily, I tried to delete the folder one more time and ths time it worked.
(I have no idea why explorer was using it.) So I won't need to go through
the steps you gave. It is good to know that commands can be executed after
explorer is closed.
 
Trevor,

Sometimes if a file is locked by some process all you need to do is reboot
or kill explorer.exe and restart it.

You can get to the Run command whether explorer.exe is running or not. If
you can get to the Run command, you can get a command prompt.

At *any* time that the Task Manager is open, you can click File | New Task
(Run...) | Type: cmd in the Run box | Click OK

New Task (Run...) is identical to the Run command on the Start menu.

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
Trevor L. said:
Wesley said:
[[Deleting the current directory
You cannot use rmdir to delete the current directory. You must first
change to a different directory (not a subdirectory of the current
directory) and then use rmdir with a path. If you attempt to delete
the current directory, the following message appears:

The process cannot access the file because it is being used by another
process.]]
Rmdir (rd)
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/rmdir.mspx

Kill explorer.exe and use the command prompt to delete the folder.

Open the Task Manager...
Ctrl + Shift + Escape | Click on the Processes tab | Locate and
highlight explorer.exe | Right click explorer.exe | Click End Process
Yes to the Task Manager Warning that pops up | File | New | CTRL key
+ click New Task (Run...)

Then type or paste into the command prompt:
rmdir C:\Documents and Settings\Trevor\My Documents\My Webs\oldzip /Q

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
Trevor L. said:
This is a simple question.

I have a folder which I can't delete as it is in use - I find
explorer.exe has it. I can't close explorer as then I want have
access to the folder to delete it

I therefore want to execute a file at start-up to do the deletion
The contents would be:
rmdir C:\Documents and Settings\Trevor\My Documents\My Webs\oldzip /Q

Where do I put this code?
Is it autoexec.bat ?
Or what?

Thanks, Wesley.

I knew that I could kill explorer.exe, but then I didn't know how to get
to the command prompt as all the icons etc, are removed. I think you are
saying that I can get to it from the Task Manager.

Luckily, I tried to delete the folder one more time and ths time it
worked. (I have no idea why explorer was using it.) So I won't need to go
through the steps you gave. It is good to know that commands can be
executed after explorer is closed.

--

Thanks again,
Trevor L.
Website: http://tandcl.homemail.com.au
 
Back
Top