Delete all Files and Directories in TEMP

  • Thread starter Thread starter Sherwion Gefferie
  • Start date Start date
S

Sherwion Gefferie

Is it possible to delete all the files and directories
from a computer thru the GP's startup script in the %
Systemdrive%\TEMP\ folder?

Thk,

Sherwin
 
Try applying a VB script as startup script. Code would be something like:

Dim oFSO
Dim oFolder
Dim oFile
Dim sSysroot
Dim oShell

Set oShell=createobject("wscript.shell")
Set oFSO=CreateObject("scripting.filesystemobject")
sSysroot=oShell.ExpandEnvironmentStrings("%SYSTEMROOT%")
Set oFolder=oFSO.GetFolder(sSysroot & "\Temp")
For Each ofile In oFolder.Files
ofile.delete
Next

Regards

Niclas Lindblom
 
Back
Top