Jump to content

small batch to delete folder and desktop shortcuts


Recommended Posts

Posted

Succes :) thank you so much. :)

 

I ended up using this:

 

@echo off

 

 

net use \\UNC\f$ /user:UNC\admin P@ssword

 

 

rd /q /s "c:\games" >>\\UNC\f$\%computername%.txt (for some reason this will not report back to the.txt )

 

 

 

 

del /q /s "C:\users\CS Dedicated Server CLI.Lnk" >>\\UNC\f$\%computername%.txt

 

 

del /q /s "C:\users\Counter-Strike WaRzOnE.LNK" >>\\UNC\f$\%computername%.txt

 

 

del /q /s "C:\users\CS Dedicated Server GUI.LNK" >>\\UNC\f$\%computername%.txt

 

 

del /q /s "C:\users\Half-Life WaRzOnE.LNK" >>\\UNC\f$\%computername%.txt

 

 

I have one question though.

 

I need to use this on about 100 computer.

Will it be to difficult to have them report back to 1 .txt file, instead of 100 files.?

Posted

The RD command will only say something if there is a problem. :)

 

With regard to reporting to 1 file, you could try adding the following command

ECHO %ComputerName% >> \\UNC\f$\Report.txt

and changing all other references of %computername%.txt to Report.txt).

  • Thanks 1
Posted

It seems like it work beautifully. :)

 

one question though.?

The computers in the report.txt are those the computer that the script ran on, or those computer that the script delete the files on.?

Posted (edited)

sorry to bother you again, but it seems that counter strike also is in the start menu.

So I added this line.

@echo off

 

 

 

 

net use \\bibdeep.nkpub.dk\f$ /user:bibdeep.nkpub.dk\username password

 

 

 

 

echo %ComputerName% >> \\bibdeep.nkpub.dk\f$\Report.txt

 

 

rd /S /q c:\games >>\\bibdeep.nkpub.dk\f$\%Report%.txt

 

 

 

 

del /q /s "C:\users\CS Dedicated Server CLI.Lnk" >>\\bibdeep.nkpub.dk\f$\%Report%.txt

 

 

del /q /s "C:\users\Counter-Strike WaRzOnE.LNK" >>\\bibdeep.nkpub.dk\f$\%Report%.txt

 

 

del /q /s "C:\users\CS Dedicated Server GUI.LNK" >>\\bibdeep.nkpub.dk\f$\%Report%.txt

 

 

del /q /s "C:\users\Half-Life WaRzOnE.LNK" >>\\bibdeep.nkpub.dk\f$\%Report

%.txt

 

 

del /q /s "C:\Users\Bruger\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Counter-Strike" >>\\bibdeep.nkpub.dk\f$\%Report%.txt

 

set folder="C:\Users\Bruger\Downloads"

cd /d %folder%

for /F "delims=" %%i in ('dir /b') do (rmdir "%%i" /s/q || del "%%i" /s/q)

 

 

 

But it delete everything else in the start menu, BUT counter-strike.!? :)

Edited by Dos_Box
Posted

We run this at deployment stage in MDT PowerShell.exe Remove-Item c:\Users\Public\Desktop\*.* . And works a treat.

 

PowerShell.exe Remove-Item c:\Users\Public\Desktop\*.*
Posted
We run this at deployment stage in MDT PowerShell.exe Remove-Item c:\Users\Public\Desktop\*.* . And works a treat.

 

I have deepfreeze running on the computers.

But I had some issues with deepfreeze, so sometimes it was thawed while it should be frozen.

And somebody installed counter-strike in that periode.

I just need to delete CS with the batch, so its not a permanent solution. :)

 

But thanks for the feedback :)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...