script bach file logoff

January 6, 2011 at 07:57:44
Specs: Windows XP
Hello to all,
i'm tryng to make Batch file to clean desktop files when users logoff
i have made the following

@echo off
echo Deleting files...
del C:\Documents and Settings\All Users\Desktop

but it seems that dont work,

anybody there can help me?

Regards


See More: script bach file logoff

Report •


#1
January 6, 2011 at 08:02:42
Use the %userprofile% variable. I do not recommend you use this code though, bacause you will delete all of the users Desktop Shortcuts which will make them very mad. Also you may just want to backup their files to their MyDocuments, BUT if you still want to do this here is the code...


@echo off
echo Deleting files...
del %userprofile%\Desktop\*.*

Safer code might be to specify the type of file you want to clean up...

@echo off
echo Deleting files...
del %userprofile%\Desktop\*.DOC


Report •

#2
January 6, 2011 at 08:26:02
hello friend i Try to make what you sad, but doens't work,

the code in batch file in the gpedit.msc is the following

@echo off
echo Deleting files...
del %userprofile%\Desktop\*.DOC

and try like you sad

@echo off
echo Deleting files...
del %userprofile%\Desktop\*.*


Report •

#3
January 6, 2011 at 09:28:23
Maybe quotes will do it, since a standard userprofile is in;
C:\Documents and Settings\...

Documents and Settings has 2 spaces.

del "%userprofile%\Desktop\"*.*

Regards,

Happy is ONE who says I am an OttoMAN.


Report •

Related Solutions

#4
January 6, 2011 at 10:18:36
Yes it is the quotes missing sorry. (use to Windows Vista) I still think you are crazy. You are going to delete everyone's Icons and have real mess on your hands if you run this code.

Report •

#5
January 6, 2011 at 10:22:33
That's what he want I think..

Strange hobby's.

Happy is ONE who says I am an OttoMAN.


Report •

#6
January 6, 2011 at 10:56:46
True, but I am still going to LMAO when his next post is how do I recover the desktop icons.

Report •

#7
January 6, 2011 at 11:10:14
I already LMAO XD

Happy is ONE who says I am an OttoMAN.


Report •

#8
January 6, 2011 at 15:12:54
Sorry, i Just want to clean waht users are making in the desktop, i Create a single account where the do login , and want to clean all the messe that they do, just that dont want to do any mess in users profile,

Is that what i Want to do, so how it would be the code to do that ?

Regards


Report •

Ask Question