|
Answer» There are some kids at my school who have installed games like halo and grand THEFT AUTO and other games on the school computers. I am in internship and have been put in charge of deleting the games from the school computers. I am wondering how I can get the directory name.
What I am doing so far is running a
Code: [Select]dir /b /s halo.exe >> location.txt
to find the location of the file. Once I find the location, I would like to be able to delete that entire folder.
Thanks for any HELP that is given, Christry this. Use with care.
set filename=halo.exe for /f "delims==" %%D in ('dir /s /b %filename%') do ( ECHO %filename% found in folder %%~dpD echo Press a key to remove all programs in that folder echo and then delete it. echo. echo Hold down Ctrl and press C to abort. echo. pause echo echo deleting files in %%~dpD del %%~dpD\*.* && echo OK echo removing folder rd %%~dpD && echo OK ) thanks so much, I am going to see if that works today and post back.
Works quite well. One more thing. I was looking around and saw this
Code: [Select]for /f "tokens=1,2,3,4 delims=." %%a in (proxy.txt) do ( ping %%a.%%b.%%c.%%d -n 3 ) and was wondering how I could read a file using that.
Would I do something like this
Code: [Select]for /f "tokens=1 delims=." %%a in (games.txt) do ( set filename=%%a
for /f "delims==" %%D in ('dir /s /b %filename%') do ( echo %filename% found in folder %%~dpD >> locations.txt echo deleting files in %%~dpD >> locations.txt echo removing folder >> locations.txt rmdir /s /q "%%~dpD" && echo OK >> locations.txt ) )
Not sure if that is correct but it was worth a shot.sorry for the bump but I ended up editing my last post like 8 hours after I posted so I haven't gotten a reply. I tried to work on it my self, but it started to delete my desktop, even though I don't have a game there. and it wasn't out putting what I wanted it to.
I have changed my original idea and would like to do something like this.
nameoffile.exe:Searching for String
|