Binnit,
You can do this sort of thing with both batch files (text files ending with .BAT or .CMD file extensions that are processed by XP's built-in commandline interpreter) and scripts (text files ending with .VBS or .JS that are processed by XP's built-in Windows Scripting Host [WSH] interpreter).
For example, if you wanted to delete the contents of a folder called 'Temp' in the root of C: then it may be easier to force the deletion of the folder itself (which would include its contents) then recreate it.
Try this:
1) In the root of C:, create a folder called 'Temp'.
2) Copy (not 'Move') some files to this newly created folder.
3) Copy/paste the following into Notepad then save as 'DeleteTemp.vbs'. You can save this file anywhere but it will make it easier for this example to save it to the 'C:\Windows\System32\GroupPolicy\Machine\Scripts\Shutdown' folder.
Code:
' Set up the scripting environment
Option Explicit
Const oSrc = "C:\Temp"
Dim Text, Title
Dim WSH, FSO, oFolders, oFolder, oSubFolders ' Object variables
Dim oFileCount, oFolderCount, oFiles, oCount
Text = "Folders" & vbCrLf & vbCrLf
' Dialog title (inc. vanity bit)
Title = "Temp File Deleter"
' Create Windows Scripting Host Shell object
Set WSH = WScript.CreateObject("WScript.Shell")
' Create FileSystem object to access the file system.
Set FSO = WScript.CreateObject("Scripting.FileSystemObject")
'Delete the folder (forcibly, to handle read-only attributes) then re-create it
FSO.DeleteFolder oSrc,True
FSO.CreateFolder oSrc
'Free memory used by objects
Set WSH = Nothing
Set FSO = Nothing
WScript.Quit()
4) Open the Group Policy Editor (run 'gpedit.msc').
5) If you want the 'DeleteTemp.vbs' script to run on startup or shutdown then navigate to 'Computer Configuration > Windows Settings > Scripts(Startup/Shutdown). Alternatively, if you want the 'DeleteTemp.vbs' script to run on logon or logoff then navigate to 'User Configuration > Windows Settings > Scripts(Logon/Logoff).
6) Select (double-click on) the event you want to run the script (Startup/Shutdown/Logon/Logoff) then click on the 'Add' button.
7) Click on the 'Browse' button.
8) Select the script you want to run then click on the 'Open' then 'OK' buttons.
More info about scripting (batch/cmd/wsh) can be found here on Tek-Tips in the scripting forums.
Hope this helps...