Quantcast
Channel: WinBuilder
Viewing all articles
Browse latest Browse all 1056

Batch file to find "real" Windows drive under Windows PE

$
0
0

I've had a little utility named DeleteGUI in my arsenal ever since way back in the PartPE days.  It simply crawls the user and system folders looking for temp files and deletes them.  It was made for XP and has not been updated for Windows 7 so it finds very few files any more due to the DOCUMENTS AND SETTING vs USERS change.  I use it to clean up a system before I Ghost it. Its simpler and faster than most of the heavier duty cleaners lik CCleaner.

 

I came up with a simple script to do most of what DeleteGUI did but am having trouble with it under WIndows PE as the "real" system disk is seldomly drive C: under PE any more as there are often one or two other partitions on the drive for recovery etc. .

 

Anyone have a script or method to determine the actual drive that the full Windows resides on so I can plug it into my batch file?

 

BTW, here's the script, any help with it would be greatly appreciated.

 

@echo off
cd /D C:\Users
REM ?-Clean Temp Folder?
for /D %%a in (*.*) do DEL /F /S /Q "%%a\AppData\Local\Temp\*.*"
for /D %%a in (*.*) do FOR /D %%b IN ("%%a\AppData\Local\Temp\*.*") DO RMDIR /S /Q "%%b"
REM ?-Clean IE Cache?
for /D %%a in (*.*) do DEL /F /S /Q "%%a\AppData\Local\Microsoft\Windows\Temporary Internet Files\*.*"
for /D %%a in (*.*) do FOR /D %%b IN ("%%a\AppData\Local\Microsoft\Windows\Temporary Internet Files\*.*") DO RMDIR /S /Q "%%b"
DEL /F /S /Q "C:\temp\*.*"
RMDIR /S /Q "C:\temp\*.*"
DEL /F /S /Q "C:\Windows\temp\*.*"
RMDIR /S /Q "C:\Windows\temp\*.*"
 


Viewing all articles
Browse latest Browse all 1056

Trending Articles