ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Post New Requests Here

Script to remove windows.old folder

(1/1)

glasskuter:
Hello again guys,
I offer a community service to assist a lot of people remotely so don't always have hands on systems I deal with. There is a problem when it comes to deleting the Windows.old folder after one has upgraded to Windows 10. I have found that using disk cleanup works to remove this folder completely if the system is BIOS based.  However, if the upgraded system is UEFI based, the windows.old folder will not completely remove.  It leaves two folders relating to driverstore. Using elevated command will not remove the folder either as it responds with "access denied". I have tried changing privileges on the folder which also doesn't work. The only way I have found to completely get rid of the remaining 2 folders within windows.old is to use the command line at boot which I can't do remotely.

I found a script on the net which is quite old and not being familiar with code I am somewhat confused by it and what I am supposed to enter into the script.  The person who wrote the script is not as proficient as you guys when it comes to simplifying instructions for script dummies like me. Would you take a look at the attached script and clarify if it is valid and if it will work to achieve my goal of completely getting rid of the windows.old folder.
Assume in your response that the path to the windows.old folder is c:\windows.old.
Thanks for your superior work.

tomos:
just making the script more accessible
(I'm not sure though if that's the right type of formatting)


--- Code: ActionScript ---REM JK-Windows.Old Deleter Version 1.0.181109 by jkadeesh@echo offsetlocalTitle Windows.Old Deleterset BAT_HOME=%~dp0set BAT_NAME=%~s0set BATFILE=%~nx0set DRVLET=%~d0 if "%1"=="" goto interactiveREM Flash related lines are meant for deleting Flash specific .OCX files which cannot be easily deletedif exist %1\Windows\System32\Macromed\Flash CD /D %1\Windows\System32\Macromed\Flash && cacls *.* /P Everyone:Fcd /d %DRVLET%takeown /f %1 /R /d yicacls %1 /grant administrators:F /trd /s /q %1goto end :interactiveclscd /d %DRVLET%\IF EXIST %DRVLET%\Windows.old ECHO. && ECHO Found %DRVLET%\Windows.old && GOTO AutoIF NOT EXIST %DRVLET%\Windows.old ECHO. && ECHO NOT FOUND %DRVLET%\Windows.old && ECHO. echo Enter folder name [with complete path] which needs to be deleted:   do i enter \c: \windows.old here in script??echo.echo To exit type "x" and press Enter keyecho.echo.set /p user=Folder Name[with path]: I’m confused about what to enter hereif "%user%"=="x" goto end if exist %user%\Windows\System32\Macromed\Flash CD /D %user%\Windows\System32\Macromed\Flash && cacls *.* /P Everyone:Fcd /d %DRVLET%\takeown /f %user% /R /d yicacls %user% /grant administrators:F /trd /s /q %user% if not "%user%"=="x" goto interactivegoto end :AutoclsECHO.cd /d %DRVLET%\set user=Windows.oldif exist %DRVLET%\%user%\Windows\System32\Macromed\Flash CD /D %DRVLET%\%user%\Windows\System32\Macromed\Flash && cacls *.* /P Everyone:Fcd /d %DRVLET%\takeown /f %user% /R /d yicacls %user% /grant administrators:F /trd /s /q %user% goto end:endECHO.ECHO Exiting...ECHO.pause
How to use the above code?
0. Disable User Access control [temporarily] - Once this task of deleting files / folders is completed,
you may want to re-enable User Access Control. To disable UAC,
go to Control Panel > User Accounts > Turn User Account Control on or off ; then uncheck the
option "Use User Account Control (UAC) to help protect your computer" and click OK. Then restart the computer.
1. Copy/paste the code to Notepad
2. Save the file with the file name as: DeleteFiles.bat to C:\ drive [any location is ok - you need
to go to the relevant location using the command line in step: 4]
Note that the 'Save as type' should be selected as "All Files (*.*)" before you click the Save button.
3. Go to Command prompt
4. Type CD \  to go to C:\
5. Type DeleteFiles foldername and then press Enter key
By default, the folder name is C:\Windows.old.
If the Windows.old folder resides in D:\ [or a different drive], then enter the drive letter accordingly
along with the folder name.
6. Then you will notice a lot of operation in the command window and the script will end with
"Exiting..." . Press any key to exit the script.
Then you will find Windows.old folder is completely removed - Note that with this method the
contents of Windows.old folder will not won't be sent to the Recycle bin.
DeleteFiles.bat can be run without supplying the folder name also - in that scenario, it will
consider Windows.old folder present in the current drive from which you run the batch file
--- End quote ---

Navigation

[0] Message Index

Go to full version