Delete a read only folder and its files

Discussion in 'Windows 7' started by NICK@NUMBER11, Feb 3, 2012.

  1. NICK@NUMBER11

    NICK@NUMBER11 MDL Expert

    Mar 23, 2010
    1,503
    720
    60
    #1 NICK@NUMBER11, Feb 3, 2012
    Last edited by a moderator: Apr 20, 2017
    Hi all,

    I am having a bit of a problem with running the last bit of code to delete the the folder and files, it deletes the files but leaves the folder, any ideas?

    BTW; the folder is set to readonly?

    Code:
    @echo off
    CLS
    TITLE Admin Installation for Windows 7
    
    :Windows Update
    echo Installing Windows Updater for future updates
    start /wait wusa.exe windows6.1-kb2533552.msu /quiet /norestart /nobackup
    
    :Malicious software removal tool
    echo Installing Malicious Software Removal Tool
    start /wait windows-kb890830-v4.4.exe /q
    
    :Misc apps 
    echo Installing Silverlight 
    start /wait Silverlight.exe /q
    
    :Defender Definitions
    echo Installing Windows Defender Definition updates
    start /wait mpas-fe.exe /Q
    
    :NET Framework 4
    echo Installing .NET 4 Framework Client and Extended packages
    start /wait dotNetFx40_Full_x86_x64_SlimSetup.exe /y
    
    :Cleanup
    rd /S /Q c:\Admin_Setup
    exit
     
  2. NICK@NUMBER11

    NICK@NUMBER11 MDL Expert

    Mar 23, 2010
    1,503
    720
    60
    #2 NICK@NUMBER11, Feb 3, 2012
    Last edited by a moderator: Apr 20, 2017
    (OP)
    sorted it now, i created a new bat file with this code in

    Code:
    @echo off
    CLS
    TITLE Cleaning up
    
    :Cleanup
    rd /S /Q c:\Admin_Setup
    rd /S /Q c:\Recovery_Setup
    SHUTDOWN -R -F -T 15
    exit
    and call it from the original cmd.