Script/batch file to run when Windows shuts down

IndyJaws

Golden Member
Nov 24, 2000
1,931
1
81
Can anyone help me create a script or batch file that will move a specific directory to the Recycle Bin each time Windows is shut down? The issue I've had is that there is no specific directory location for the Recycle Bin from what I can see. Any help is greatly appreciated.

Thanks in advance,
IndyJaws
 

skace

Lifer
Jan 23, 2001
14,488
7
81
(BASED ON WINDOWS XP)

Ok I grabbed some info for you, but you are going to have to do some testing.

The recycling bin should be "C:\Recycler\<currently logged on users SID>".

To find the currently logged on users sid do: getsid \\<DC SERVER> %username% \\<DC SERVER> %username%

getsid is a resource kit utility.
 

skace

Lifer
Jan 23, 2001
14,488
7
81
Example of grabbing the current sid (this assumes it has no problems finding the sid):

for /f "tokens=7" %%i in ('getsid \\bleh %username% \\bleh %username%') do set csid=%%i

There may be a better way to get the current sid via the registry, but I couldn't find one... I don't mess with sids very often.