Can't delete WindowsApps and other backup folders from storage drive


  1. Posts : 2
    Windows 10
       #1

    Can't delete WindowsApps and other backup folders from storage drive


    I recently created a backup or restore point (im not sure which at this point) But it has created several folders, namely: Program Files, WindowsApps and WpSystem, all of which are in my secondary hard drive. Windows does not recognize that I have a backup (or some remains of, I may have cancelled the backup partway through the process) in the control panel or in any backup or restore options. I have tried to force delete these files using cmd, powershell, transferring ownership, however i cannot delete them as they are either not found (in the command prompt) or are in use by SYSTEM. Any idea how I can delete these folders?
      My Computer


  2. Posts : 5,330
    Windows 11 Pro 64-bit
       #2

    Check disk for filesystem errors by executing Chkdsk X: /f command. Replace X: drive letter with secondary hard drive.

    Take ownership of the folders you want to delete this batch script adds Take ownership to context menu.


    Code:
    @Echo Off
    
    
    REM  --> Check for permissions
    Reg query "HKU\S-1-5-19\Environment" 
    REM --> If error flag set, we do not have admin.
    if %errorlevel% NEQ 0 (
    ECHO                 **************************************
    ECHO                  Running Admin shell... Please wait...
    ECHO                 **************************************
    
        goto UACPrompt
    ) else ( goto gotAdmin )
    
    :UACPrompt
        echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
        set params = "%*:"=""
        echo UAC.ShellExecute "cmd.exe", "/c ""%~s0"" %params%", "", "runas", 1 >> "%temp%\getadmin.vbs"
    
        "%temp%\getadmin.vbs"
        del "%temp%\getadmin.vbs"
        exit /B
    
    
    :gotAdmin
    
    Cls & Mode CON  LINES=11 COLS=104 & Color 0E & Title Created By FreeBooter
    Echo.
    Echo.
    Echo.
    Echo.       
    Echo         Do You Want To Add Take Ownership to the Right-Click Menu in Windows Explorer (Y/N)?    
    Echo.       
    Echo.
    Echo.
    
    
    Set /p input= RESPONSE: 
    
    If /i  Not %input%==Y (Goto :_Ex) Else (Goto :_Start) 
    
    :_Ex
    If /i Not %input%==N  (Goto :EOF) Else (Goto :_RegRestore)
    
    
    
    :_Start
    
    Reg.exe add "HKCR\*\shell\runas" /ve /t REG_SZ /d "Take Ownership" /f > Nul
    Reg.exe add "HKCR\*\shell\runas" /v "NoWorkingDirectory" /t REG_SZ /d "" /f > Nul
    Reg.exe add "HKCR\*\shell\runas\command" /ve /t REG_SZ /d "cmd.exe /c takeown /f \"%%1\" && icacls \"%%1\" /grant administrators:F" /f > Nul
    Reg.exe add "HKCR\*\shell\runas\command" /v "IsolatedCommand" /t REG_SZ /d "cmd.exe /c takeown /f \"%%1\" && icacls \"%%1\" /grant administrators:F" /f > Nul
    Reg.exe add "HKCR\Directory\shell\runas" /ve /t REG_SZ /d "Take Ownership" /f > Nul
    Reg.exe add "HKCR\Directory\shell\runas" /v "NoWorkingDirectory" /t REG_SZ /d "" /f > Nul
    Reg.exe add "HKCR\Directory\shell\runas\command" /ve /t REG_SZ /d "cmd.exe /c takeown /f \"%%1\" /r /d y && icacls \"%%1\" /grant administrators:F /t" /f > Nul 
    Reg.exe add "HKCR\Directory\shell\runas\command" /v "IsolatedCommand" /t REG_SZ /d "cmd.exe /c takeown /f \"%%1\" /r /d y && icacls \"%%1\" /grant administrators:F /t" /f > Nul
    
    
    Cls & Mode CON  LINES=11 COLS=60 & Color 0E & Title Created By FreeBooter
    Echo.
    Echo.
    Echo.
    Echo.       
    Echo          Take Ownership Context Menu Enabled   
    Echo.       
    Echo.
    Echo. 
    
    Taskkill /im Explorer.exe /f >Nul
    
    Start Explorer.exe
    
    ping -n 6 localhost >Nul 
    Exit
    
    
    :_RegRestore
    
    
    Reg.exe delete "HKCR\*\shell\runas" /f > Nul
    Reg.exe delete "HKCR\Directory\shell\runas" /f > Nul
    
    
    Cls & Mode CON  LINES=11 COLS=60 & Color 0E & Title Created By FreeBooter
    Echo.
    Echo.
    Echo.
    Echo.       
    Echo         Take Ownership Context Menu Disabled    
    Echo.       
    Echo.
    Echo. 
    
    Taskkill /im Explorer.exe /f >Nul
    
    Start Explorer.exe
    
    ping -n 6 localhost >nul 
    Exit
      My Computer


  3. Posts : 2
    Windows 10
    Thread Starter
       #3

    I've already taken ownership of the folders, I cannot delete them because they are in use by SYSTEM and another is in use by explorer.exe
      My Computer


  4. Posts : 5,330
    Windows 11 Pro 64-bit
       #4
      My Computer


  5. Posts : 920
    Windows 10 Pro
       #5

    Did you by any chance relocate the default drive for saving new installs of apps (think only UWP apps are affected), if so change back and either those folders will disappear or you may be able to delete them after.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 05:16.
Find Us




Windows 10 Forums