Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Logoff script erase folders
Name: jonez34 Date: February 16, 2006 at 08:13:54 Pacific OS: Windows 2000 CPU/Ram: intel 256 mb ram Product: IBM
Comment:
I currently have a logoff script that erases shortcuts off a users desktop and leaves only the All Users shortcuts which admins can control. The only issue is that I have noticed that users have been saving folders to the desktop I cannot figure out a way to delete them off the desktop. I have tried the following script with no luck.
Name: shahramsh Date: February 17, 2006 at 15:37:18 Pacific
Reply:
this: rd "%userprofile%"\Desktop /s /q should remove the whole destop folder with the subfolders and files,
but if you want to remove the individual folders, this should work in an english windows:
@echo off cd "%userprofile%"\Desktop if "%1"==":rd" goto rd if exist %temp%\temprd01.tmp del %temp%\temprd01.tmp >nul dir /a:d | find "<DIR>" | find /v "<DIR> .." | find /v "<DIR> .">%temp%\temprd01.tmp for /f "tokens=2 delims=<DIR>" %%I in (%temp%\temprd01.tmp) do call %0 :rd %%I :rd if "%2"=="" goto EOF set var=%* set var=%var:~14% rd "%var%" /s /q :EOF
0
Response Number 2
Name: shahramsh Date: February 17, 2006 at 16:21:38 Pacific
Reply:
sorry and easier way, just forgot about "/b" in dir,
@echo off cd "%userprofile%"\Desktop if exist %temp%\temprd01.tmp del %temp%\temprd01.tmp >nul dir /a:d /b >%temp%\temprd01.tmp for /f "delims=" %%I in (%temp%\temprd01.tmp) do rd "%%I" /s /q
0
Response Number 3
Name: shahramsh Date: February 17, 2006 at 16:24:57 Pacific
Reply:
even easier :
@echo off for /f "delims=" %%I in ('dir /a:d /b') do rd "%%I" /s /q
0
Response Number 4
Name: jonez34 Date: February 20, 2006 at 16:00:03 Pacific
Reply:
Thanks for the info. This is really gonna help. I can't thank you guys enough.
Summary: Hi, I am trying to run my program in client, which logon to a domain server. Now I hope to get the logoff script file from the domain server. This logoff script is used by my client. Is anybody know h...
Summary: Hi, I'm using a batch file to copy over outlook pst files to the network when a user logoff their computers for the night. The problem is some users claims that once in a while the computer will auto...
Summary: Hi Try this. -------- Dim FSO, Folder set FSO=CreateObject("Scripting.FileSystemObject") Folder="\Test" wscript.echo wscript.echo "Delete a Folder" FSO.DeleteFolder(Folder) wscript.echo Folder,"now d...