Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

IF NOT GO TO BAT File Help


  • Please log in to reply
4 replies to this topic

#1 pntblltrc4

pntblltrc4

  • Members
  • 13 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:08:55 AM

Posted 16 June 2011 - 08:13 PM

OK I am working on a login script that removes torrent software from a network, I have the program working great, but when it cannot find a file it states cannot find..which is good but, my question is how do I setup a if not go to next file, so it does not display that? Any bat masters out there :^).
Isaiah 54:17
No weapon that is formed against thee shall prosper; and every tongue [that] shall rise against thee in judgment thou shalt condemn. This [is] the heritage of the servants of the LORD, and their righteousness [is] of me, saith the LORD.

BC AdBot (Login to Remove)

 


#2 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:06:55 AM

Posted 16 June 2011 - 11:47 PM

Probably would be helpful to see your script.

#3 JosiahK

JosiahK

  • Members
  • 269 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:01:55 PM

Posted 17 June 2011 - 06:13 AM

If I've understood you correctly that shouldn't be too hard, but as Groovicus says the code is a must.
Quod non mortiferum, fortiorem me facit.
I don't read minds. Please help everyone by answering any questions and reporting on the results of any instructions. Query any concerns and explain problems or complications.

#4 pntblltrc4

pntblltrc4
  • Topic Starter

  • Members
  • 13 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:08:55 AM

Posted 24 June 2011 - 07:29 PM

Sorry it took so long for me to respond, here is what I have. The program works great as a login script the only thing is, it says cannot find if the file doesn't exist, so how can I get it to pass to the next file without the cannot find error, I know it's a if not go to, but I'm not sure how it is done. Still learning the batch mastery :)


del C:\BearShare.exe /S /Q /AH /A-H /F


del C:\avformat-51.dll /S /Q /AH /A-H /F


del C:\FrostWire.exe /S /Q /AH /A-H /F


del C:\jdic.dll /S /Q /AH /A-H /F

and this keeps going until all the programs are searched for.
Isaiah 54:17
No weapon that is formed against thee shall prosper; and every tongue [that] shall rise against thee in judgment thou shalt condemn. This [is] the heritage of the servants of the LORD, and their righteousness [is] of me, saith the LORD.

#5 Nate15329

Nate15329

  • Members
  • 92 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:WI, USA
  • Local time:06:55 AM

Posted 25 June 2011 - 12:52 AM

I wrote this tonight and thought you would update the torrent list often, so it checks the torrent list file from a server that you specify when users login. I haven't debugged it to increase speed of it though.
Here's the batch file code:

@echo off
rem change source to where the list of software that must be deleted
rem this writes to C:\tmp.txt, change appropriately
rem It must be in this format(no more than 8100 lines and no blank lines):
rem Frostwire.exe
rem avformat-51.dll
set source = \\server\$share\deltorrent.txt
rem don't change below vars
set curloc="%~dp0"
rem Goes to root of drive
cd C:\
for /F "delims=<tab> tokens=* usebackq" %%i in (%source%) do (
dir %%i /s /B >> C:\tmp.txt
)
rem Remove files
for /F "delims=<tab> tokens=* usebackq" %%b in (C:\tmp.txt) do ( if exist %%b ( del %%b /f /q))
rem deletes tmp file
del /f /q C:\tmp.txt
rem returns to current location
cd %curloc%
echo "Task Completed"
exit


Inside Example of deltorrent.txt:

BearShare.exe
avformat-51.dll
FrostWire.exe
jdic.dll






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users