Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account


Photo

Safe to Delete files in Windows\Temp folder

- - - - -

  • Please log in to reply
14 replies to this topic

#1
spacesurfer

spacesurfer

    Pharmassist

  • Patrons
  • 1,668 posts
  • OS:Windows 7 x86
  • Country: Country Flag
Is it safe to delete files in C:\windows\temp folder in vista? I routinely did it for XP but in Vista, security box pop-up the first time I looked inside this folder.
_____________________________________________________________________
[Modify Office 2007 / 2010 Ribbon UI] [Javascript Guide] [Methods of Typing in Gujarati] [My Math Pages]
[Boot Windows 7 from VHD] [Multi-boot Vista/XP and other OSes with Grub Menu] [Boot XP and Vista Independently]


Gigabyte GA-P35-DS3L, Intel Core 2 Duo E6550 2.33 GHz, ASUS Radeon EAH3450 256 MB, 6 GB Corsair RAM, Maxtor 300 GB + Seagate 400 GB HDDs, Windows 7 Ultimate 64-bit
IBM T42 Intel Pentium M 1.7 GHz, 1.5 GB RAM, Radeon Mobility 7500, 160 GB HDD, Windows 7 Ultimate 32-bit


How to remove advertisement from MSFN

#2
LeveL

LeveL

    Senior Member

  • Member
  • PipPipPipPip
  • 551 posts
Vista is crap thats why.

It probably has security boxes for the security boxes for the security boxes.

I say just delete the contents of the temp folder and ignore the POS.

#3
Shark007

Shark007

    Repackaging Specialist

  • Member
  • PipPipPipPipPipPipPipPipPip
  • 3,154 posts

Is it safe to delete files in C:\windows\temp folder in vista? I routinely did it for XP but in Vista, security box pop-up the first time I looked inside this folder.

Yes, it is safe to delete files in that temp folder.

Vista is crap thats why...I say just delete the contents of the temp folder and ignore the POS.

Just curious ...

With that opinion of Vista, why did you even bother to come into a section entitled:
Microsoft Operating Systems - Software Discussion & Support > Windows Vista

Are you actually the maintainer of the BBS linked in your signature?
I'll be sure to avoid that one when seeking advice.


shark

#4
LeveL

LeveL

    Senior Member

  • Member
  • PipPipPipPip
  • 551 posts

With that opinion of Vista, why did you even bother to come into a section entitled:
Microsoft Operating Systems - Software Discussion & Support > Windows Vista


Because I was answering a question about Windows Vista.

Me hating the bloated POS doesn't mean people don't need help with it.

Are you actually the maintainer of the BBS linked in your signature?


Its not BBS its an Invision Power Board, the same type as MSFN.

No, I am not the maintainer, but I know plenty of people here have copied
Bold_Fortune's 4 years of hard work, and given him no credit whatsoever in
return. I think he deserves more credit than he gets, so I link to his forum.

I'll be sure to avoid that one when seeking advice.


Why, there's nothing on this MSFN forum, or indeed on the entire internet for that matter,
that comes remotely close to the level of detail on Bold_Fortune's site. If there was I would
probably be linking to it and not Bold_Fortune's site.

#5
Andromeda43

Andromeda43

    Retired PC Tech.

  • Member
  • PipPipPipPipPipPip
  • 1,018 posts
  • OS:XP Pro x86
  • Country: Country Flag
Since the (POC) writers of Vista changed so many old time names of files and folders I'm sure surprised to hear that they didn't change Temp files to "Only needed today" files or sum such foolishness.

Temp files means "Temporary"......that means only needed while the creating program was still open and running.
After that they are just as much Garbage in Vista as they were in Windows 95, 98, 98/SE, ME, XP, 2K, NT, etc.

For more years than I want to count anymore, I've had a line in my startup files that deletes all temp files, temporary internet files and anything else I can find of a similar nature. How about Recent files, Prefetch files, cache files, AV Quarantine files? They are all junk and should be deleted on a very regular basis to keep your HD clean and running at peak efficiency.

Running windows "Disk Cleanup" on a regular (even daily) basis is a good place to start. There's still more junk that builds up on your HD that even Disk Cleanup won't delete. I didn't say "Can't",,,,I just said, "Won't".
Do a windows Search for *.log and see how many entries pop up. Most of those are temp files too.

Remember: "Minus Crud is Cool!" :thumbup

Andromeda43 :ph34r:
A person with experience is never at the mercy of a person with an argument.

#6
LeveL

LeveL

    Senior Member

  • Member
  • PipPipPipPip
  • 551 posts
You could just use CCleaner...

http://www.ccleaner.com/

v1.37.456 - [1st Feb 2007]
- Improved Vista compatibility.

Don't forget to untick Firefox and Opera (and IE if you use that, giggle)
otherwise you'll have to log back into all the forums you might be a
member of again.

Edited by LeveL, 03 April 2007 - 09:44 AM.


#7
redxii

redxii

    Member

  • Member
  • PipPip
  • 286 posts
Ignorance runs high.

C:\Windows\Temp or \WINNT\Temp in 2000 has always been a restricted folder that non-admin users can't open. Vista accounts default to non-admin "Admins" which means you are a non-admin and admin tokens are only used when needed, hence the UAC prompt. It's just a secure way of using ANY modern operating system, which many people like LeveL don't approve of yet complain about security.

#8
waruikoohii

waruikoohii

    Newbie

  • Member
  • 35 posts
Prefetch actually decreases an applications launch time, so clearing the folder is bad for performance.

Edited by waruikoohii, 03 April 2007 - 01:12 PM.


#9
Eck

Eck

    Senior Member

  • Member
  • PipPipPipPip
  • 669 posts
The root's tmp folder in Linux performs the same way.

Folks just aren't used to an operating system designed for both use AND security. You can still clean it out but just a few extra steps are in order, and that's a good thing.
Epox EP8KRAIPRO AthlonXP3200+ NVidia GeForce 6600GT AGP Audigy 2 ZS Crucial 2x1024MB 3200 RAM

#10
gunsmokingman

gunsmokingman

    MSFN Master

  • Super Moderator
  • 2,418 posts
  • OS:none specified
  • Country: Country Flag
Here is a VBS script to delete all the files and none system folder in the temp directory
Save As CleanTemp.vbs

Dim Act, Arg1, File, Folder, Fso, StrF,WMI
  Set Act = CreateObject("Wscript.Shell")
  Set Fso = CreateObject("Scripting.FileSystemObject")
  Set Folder = Fso.GetFolder(Act.ExpandEnvironmentStrings("%SystemRoot%\Temp"))
  Set File = Folder.Files 
'/-> Collect The Files In The Temp Folder
   For Each StrF In File
	Set Arg1 = Fso.GetFile(StrF.Path) 
	If Fso.FileExists(Arg1.Path) Then Arg1.Delete() End If 
   Next
 Dim Computer : Computer = "."
  Set WMI = GetObject("winmgmts:\\" & Computer & "\root\cimv2")
  Set Folder = WMI.ExecQuery("Associators of {Win32_Directory.Name='" & Folder.Path & "'} " _
					 & "Where AssocClass = Win32_Subdirectory  ResultRole = PartComponent")
'/-> Collect The Folders In The Temp Folder				
   For Each StrF in Folder
	Set Arg1 = Fso.GetFolder(StrF.Name)
	If Fso.FolderExists(Arg1.Path) Then
'/-> Deletes Only None System Folders
	 If StrF.System = 0 Then  Arg1.Delete() End If
	End If  
   Next




GunSmokingMan



#11
Andromeda43

Andromeda43

    Retired PC Tech.

  • Member
  • PipPipPipPipPipPip
  • 1,018 posts
  • OS:XP Pro x86
  • Country: Country Flag
Kewl !

I love scripts. I use them every day in my own PC tuneup business.
They can just be tailored to do so many neat things.
Like shutdown redundant services, delete old restore points, etc.

But, for a home user that doesn't have to worry about corporate or Office security,
why not just shut off that very annoying Security Warning popup?
That was the first tweak I did to my own Vista machine.
And also give that same user the highest Admin priority possible.
Another "Must-DO" for home users (and the tech that has to support them).

Now there's a great idea for a VBScript! Any script writers ready to jump on that one?

I know that many of us non-script-writers would sure be very thankful.

:ph34r:
A person with experience is never at the mercy of a person with an argument.

#12
gunsmokingman

gunsmokingman

    MSFN Master

  • Super Moderator
  • 2,418 posts
  • OS:none specified
  • Country: Country Flag

And also give that same user the highest Admin priority possible.

I can not be sure but you can not script something like that. It possible I think
to use the run as in a script, but do not quote me on that.
If you have some ideas about what you would like to script to do I might try
and write a couple for you.
Here is a simple script that list the install date and the last boot time
Save As Install_LastBoot.vbs

strComputer = "."
 Dim Wmi :Set Wmi = GetObject("winmgmts:" _
 & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
 Dim Dtm :Set Dtm = CreateObject("WbemScripting.SWbemDateTime")
 Dim BootTime, ColItem, CreationTime, ObjItems, Var1
  Set ObjItems = Wmi.ExecQuery("Select * from Win32_OperatingSystem")
   For Each ColItem in ObjItems
	Dtm.Value = ColItem.InstallDate 
	CreationTime = Dtm.GetVarDate
	Dtm.Value = ColItem.LastBootUpTime
	BootTime = Dtm.GetVarDate
	Var1 = ColItem.Caption & " - " & ColItem.Version
   Next
   MsgBox "OS Install Date" & vbTab & Chr(187) & " " & CreationTime & vbCrLf &_
		  "OS Boot Up Time" & vbTab & Chr(187) & " " & BootTime,4128,Var1




GunSmokingMan



#13
Shark007

Shark007

    Repackaging Specialist

  • Member
  • PipPipPipPipPipPipPipPipPip
  • 3,154 posts
There is nothing quite like a script from Gunsmokingman.


I have always admired your work, thanks for sharing once again :thumbup



shark

When posting about an issue in the codec thread,
please state what Operating System you use.


#14
Mr Snrub

Mr Snrub

    Former MSFT

  • Super Moderator
  • 775 posts
  • OS:Windows 8 x64
  • Country: Country Flag
I wouldn't recommend automating the deletion of files & folders in a temporary folder that is also an environment variable - the main reason being that some processes may put "post-boot" files in there to perform some operations after the OS is restarted (due to file locks or services that cannot be restarted at that time).

So if your clever deletion routine kicks in before the process is called, it never finishes its work and you leave the system in an unknown, possibly unstable state.

By all means check manually every so often after a clean reboot and check for files that have been clearly left behind after an application crash (or poorly programmed application) - the modified date on the files is the best indicator.

My TechNet Blog
I have CDO. It's like OCD except the letters are in alphabetical order, as they should be.


#15
gunsmokingman

gunsmokingman

    MSFN Master

  • Super Moderator
  • 2,418 posts
  • OS:none specified
  • Country: Country Flag

I wouldn't recommend automating the deletion of files & folders in a temporary folder that is also an environment variable - the main reason being that some processes may put "post-boot" files in there to perform some operations after the OS is restarted (due to file locks or services that cannot be restarted at that time).

So if your clever deletion routine kicks in before the process is called, it never finishes its work and you leave the system in an unknown, possibly unstable state.

By all means check manually every so often after a clean reboot and check for files that have been clearly left behind after an application crash (or poorly programmed application) - the modified date on the files is the best indicator.


Here is a VBS script that will delete the files or folders 2 days after they where created
Sace As CleanSysTemp_2.vbs

Dim dtmDate, ObjD, StrC, StrD, StrM, StrTD, StrY, Wmi
 Dim Act, ColItem, Folder, Fso, ObjItem
'/-> Change This To Suit Your Needs 
 dtmDate = Date - 2 '/-> Amount Of Days
 StrD = Day(dtmDate)
 StrM = Month(dtmDate)
 StrY = Year(dtmDate)
 StrC = "."
'/-> Add A Zero To The Date If Needed
  If Len(StrD) < 2 Then  StrD = "0" & StrD End If
  If Len(StrM) < 2 Then StrM = "0" & StrM End If
 StrTD = StrY & StrM & StrD
  Set Act = CreateObject("Wscript.Shell")
  Set Fso = CreateObject("Scripting.FileSystemObject")
  Set Folder = Fso.GetFolder(Act.ExpandEnvironmentStrings("%SystemRoot%\Temp"))
  Set File = Folder.Files 
  Set Wmi = GetObject("winmgmts:\\" & StrC & "\root\cimv2")
'/->
 CleanUpFilesInTemp()
 Function CleanUpFilesInTemp()
  Set ColItem = Wmi.ExecQuery("ASSOCIATORS OF {Win32_Directory.Name='" & Folder.Path & "'} Where " _
	  & "ResultClass = CIM_DataFile")
'/-> Delete Files That Havnt Been Access In 2 Days
   For Each ObjItem In ColItem
	ObjD = Left(ObjItem.CreationDate, 8)
	If ObjD < StrTD Then : ObjItem.Delete : End If
   Next
  End Function
'/->
  CleanUpFoldersINtemp()
  Function CleanUpFoldersINtemp()
  Set ColItem = WMI.ExecQuery("Associators of {Win32_Directory.Name='" & Folder.Path & "'} " _
					 & "Where AssocClass = Win32_Subdirectory  ResultRole = PartComponent")
'/-> Collect The Folders In The Temp Folder				
   For Each ObjItem in ColItem
	Set Arg1 = Fso.GetFolder(ObjItem.Name)
	If Fso.FolderExists(Arg1.Path) Then
'/-> Delete Folders That Havnt Been Access In 2 Days	
	 ObjD = Left(ObjItem.CreationDate, 8)
	 If ObjD < StrTD Then
'/-> Deletes Only None System Folders
	  If ObjItem.System = 0 Then : Arg1.Delete() : End If
	 End If
	End If   
   Next
  End Function




GunSmokingMan






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users



How to remove advertisement from MSFN