Solved is it safe to remove Temp folder before Windows update?


Sheikh

Well-known member
Member
Local time
3:54 PM
Posts
244
Location
Tehran, IRAN.
OS
Windows 11 Pro 24H2
Hey everyone!
I have changed the "C:\Users\***\AppData\Local\Temp" and "C:\Windows\Temp" directory to my HDD which is "G:\Temp\"
then I created a .bat file with this code:
Code:
cleanmgr /sagerun 1
pushd "G:\Temp\" && (rd /s /q "G:\Temp\" 2>nul & popd)
then added the .bat file to Group Policy / User Config / Windows settings / Scripts / Logoff
So, whenever I click on restart or shutdown, Windows will run disk cleaner and then clears the G:\temp subfolders and files.
is it safe to click on restart after a Windows update? Does windows update store files in temp folders during an installation? or it's better to deactivate the .bat file before updating to make sure it doesn't ruin the update...
any suggestions?
thanks.
 

My Computers

System One System Two

  • OS
    Windows 11 Pro 24H2
    Computer type
    Laptop
    Manufacturer/Model
    Huawei MateBook D15
    CPU
    Ryzen 5 3500U
    Memory
    8GB
    Graphics Card(s)
    Vega 8
    Screen Resolution
    FHD
    Hard Drives
    256GB Samsung SSD + 1TB HDD
    Browser
    Microsoft Edge
    Antivirus
    ESET Smart Security Premium
  • Operating System
    Windows 10 Enterprise LTSC 21H2
    Computer type
    Laptop
    Manufacturer/Model
    MSI GS73 6RF Stealth Pro
    CPU
    intel core i7 6700HQ
    Memory
    16GB
    Graphics card(s)
    Nvidia Geforce GTX1060 (6GB)
    Screen Resolution
    FHD
    Hard Drives
    128GB SSD + 1TB HDD
    Browser
    Microsoft Edge
    Antivirus
    Windows Defender
Disk Cleanup (cleanmgr) will only delete temporary files with a last access timestamp older than seven days, as indicated by the LastAccess value in the registry...

Code:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Temporary Files]
@="{0B2C35D2-C8BC-4470-BFC0-D6BB1235E5CE}"
"Autorun"=dword:00000001
"FileList"="*.*"
"Flags"=dword:00000041
"LastAccess"=dword:00000007
"PropertyBag"="{60F6E465-4DEF-11d2-B2D9-00C04F8EEC8C}"
"ReserveIDHint"=dword:00000002

That's a perfectly safe thing to do. Cleaning the temp directory entirely every reboot seems excessive.
 

My Computer

System One

  • OS
    Windows 11 Pro 24H2 [rev. 4061]
    Computer type
    PC/Desktop
    Manufacturer/Model
    Intel NUC12WSHi7
    CPU
    12th Gen Intel Core i7-1260P, 2100 MHz
    Motherboard
    NUC12WSBi7
    Memory
    64 GB
    Graphics Card(s)
    Intel Iris Xe
    Sound Card
    built-in Realtek HD audio
    Monitor(s) Displays
    Dell U3219Q
    Screen Resolution
    3840x2160 @ 60Hz
    Hard Drives
    Samsung SSD 990 PRO 1TB
    Keyboard
    CODE 104-Key Mechanical with Cherry MX Clears
    Antivirus
    Microsoft Defender
WU uses its own staging folders to download and extract updates. It doesn't care about any other folders that exist.

Cleanmgr wants to clean files up, because it's designed to clear enough disk space to allow a major Feature upgrade to run. Windows doesn't want a pending update/upgrade blocked simply because it ran out of disk space on C:\.

The normal Windows temp and user temp folders are targeted, simply because there's an understanding those are allowed for periodic cleanup. While cleanmgr runs in order to help WU, WU is indifferent on how it gets done except that nobody touches WU's staging folders.
 

My Computer

System One

  • OS
    Windows 7
Disk Cleanup (cleanmgr) will only delete temporary files with a last access timestamp older than seven days, as indicated by the LastAccess value in the registry...

Code:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Temporary Files]
@="{0B2C35D2-C8BC-4470-BFC0-D6BB1235E5CE}"
"Autorun"=dword:00000001
"FileList"="*.*"
"Flags"=dword:00000041
"LastAccess"=dword:00000007
"PropertyBag"="{60F6E465-4DEF-11d2-B2D9-00C04F8EEC8C}"
"ReserveIDHint"=dword:00000002

That's a perfectly safe thing to do. Cleaning the temp directory entirely every reboot seems excessive.
Thanks dear Pseymour.
Yea I think so... it's excessive. I'm developing an engineering software with python which works with Simulia ABAQUS and I have to use the temp folder a lot. so I have to clean it twice a day at least!
My question is about Windows update. I'm afraid cleaning user or windows temp breaks the update I don't know :(
 

My Computers

System One System Two

  • OS
    Windows 11 Pro 24H2
    Computer type
    Laptop
    Manufacturer/Model
    Huawei MateBook D15
    CPU
    Ryzen 5 3500U
    Memory
    8GB
    Graphics Card(s)
    Vega 8
    Screen Resolution
    FHD
    Hard Drives
    256GB Samsung SSD + 1TB HDD
    Browser
    Microsoft Edge
    Antivirus
    ESET Smart Security Premium
  • Operating System
    Windows 10 Enterprise LTSC 21H2
    Computer type
    Laptop
    Manufacturer/Model
    MSI GS73 6RF Stealth Pro
    CPU
    intel core i7 6700HQ
    Memory
    16GB
    Graphics card(s)
    Nvidia Geforce GTX1060 (6GB)
    Screen Resolution
    FHD
    Hard Drives
    128GB SSD + 1TB HDD
    Browser
    Microsoft Edge
    Antivirus
    Windows Defender
WU uses its own staging folders to download and extract updates. It doesn't care about any other folders that exist.

Cleanmgr wants to clean files up, because it's designed to clear enough disk space to allow a major Feature upgrade to run. Windows doesn't want a pending update/upgrade blocked simply because it ran out of disk space on C:\.

The normal Windows temp and user temp folders are targeted, simply because there's an understanding those are allowed for periodic cleanup. While cleanmgr runs in order to help WU, WU is indifferent on how it gets done except that nobody touches WU's staging folders.
Thanks dear @garlin
as always you and dear Pseymour solved my problem.:kiss::kiss::kiss:
Topic marked as solved.
 

My Computers

System One System Two

  • OS
    Windows 11 Pro 24H2
    Computer type
    Laptop
    Manufacturer/Model
    Huawei MateBook D15
    CPU
    Ryzen 5 3500U
    Memory
    8GB
    Graphics Card(s)
    Vega 8
    Screen Resolution
    FHD
    Hard Drives
    256GB Samsung SSD + 1TB HDD
    Browser
    Microsoft Edge
    Antivirus
    ESET Smart Security Premium
  • Operating System
    Windows 10 Enterprise LTSC 21H2
    Computer type
    Laptop
    Manufacturer/Model
    MSI GS73 6RF Stealth Pro
    CPU
    intel core i7 6700HQ
    Memory
    16GB
    Graphics card(s)
    Nvidia Geforce GTX1060 (6GB)
    Screen Resolution
    FHD
    Hard Drives
    128GB SSD + 1TB HDD
    Browser
    Microsoft Edge
    Antivirus
    Windows Defender
Back
Top Bottom