Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: End process and delete file every 5 seconds  (Read 2566 times)

0 Members and 1 Guest are viewing this topic.

Khasiar

    Topic Starter


    Intermediate

    End process and delete file every 5 seconds
    « on: October 26, 2009, 09:12:00 PM »
    hey guys, having an issue with a virus that keeps reappearing after i delete it, i am trying to temporaily fix this problem until a security update is released..

    im not sure how to end a process through batch but i can delete with

    @echo off
    :loop
    (put a timer in for 5 seconds)
    (end procces)
    del name.ext
    goto loop


    any help would really be appreciated, i think my works been hit with a new virus :s



    BatchFileBasics



      Hopeful

      Thanked: 18
      Re: End process and delete file every 5 seconds
      « Reply #1 on: October 26, 2009, 09:21:30 PM »
      batch is no way to solve a virus problem, this might just agitate it  ;).

      if you need an anti virus, there are many free
      avast!
      AVG
      Bit defender


      though if you are just looking for an answer, a simple timeout would
      sleep
      Quote
      Usage:  sleep      time-to-sleep-in-seconds
              sleep [-m] time-to-sleep-in-milliseconds
              sleep [-c] commited-memory ratio (1%-100%)

      or using ping, replace 2 with the number of timeout you want
      Quote
      ping localhost -n 2 -w 1000 >nil

      as for proccess kill, taskkill or tskill:
      Code: [Select]
      TSKILL processid | processname [/SERVER:servername] [/ID:sessionid | /A] [/V]

        processid           Process ID for the process to be terminated.
        processname         Process name to be terminated.
        /SERVER:servername  Server containing processID (default is current).
                               /ID or /A must be specified when using processname
                               and /SERVER
        /ID:sessionid       End process running under the specified session.
        /A                  End process running under ALL sessions.
        /V                  Display information about actions being performed.
      When the power of love overcomes the love of power the world will know peace - Jimi Hendrix.

      Khasiar

        Topic Starter


        Intermediate

        Re: End process and delete file every 5 seconds
        « Reply #2 on: October 26, 2009, 09:22:34 PM »
        yea i know, but its an exchange problem thats spamming our servers, like i said this is just temporary. ive found that i can use ping to set time but it looks very messy, any other way?

        Khasiar

          Topic Starter


          Intermediate

          Re: End process and delete file every 5 seconds
          « Reply #3 on: October 27, 2009, 04:44:31 PM »
          sleep doesnt work, in XP anyway

          Helpmeh



            Guru

          • Roar.
          • Thanked: 123
            • Yes
            • Yes
          • Computer: Specs
          • Experience: Familiar
          • OS: Windows 8
          Re: End process and delete file every 5 seconds
          « Reply #4 on: October 27, 2009, 04:48:29 PM »
          @echo off
          :loop
          tskill PROCESS (without .exe)
          del File.ext
          ping localhost -n 5 -w 1000>nul
          goto loop

          But PLEASE go to the computer viruses section to REMOVE your problem, not just hide a symptom.
          Where's MagicSpeed?
          Quote from: 'matt'
          He's playing a game called IRL. Great graphics, *censored* gameplay.

          billrich

          • Guest
          Re: End process and delete file every 5 seconds
          « Reply #5 on: October 27, 2009, 05:27:24 PM »
          sleep doesnt work, in XP anyway

          I use XP Pro and sleep works very well.

          @echo off

          Code: [Select]
          set /a c=0
          :here
          echo Sleep 3 seconds and repeat
          echo when count is 10 quit
          echo count = %c%
          C:\batextra\sleep.exe  3

          set /a c+=1

          if %c% EQU 10  exit /b

          goto here

          OutPut:

          C:\batextra> reploop.bat
          Sleep 3 seconds and repeat
          when count is 10 quit
          count = 0
          Sleep 3 seconds and repeat
          when count is 10 quit
          count = 1
          Sleep 3 seconds and repeat
          when count is 10 quit
          count = 2
          Sleep 3 seconds and repeat
          when count is 10 quit
          count = 3
          Sleep 3 seconds and repeat
          when count is 10 quit
          count = 4
          Sleep 3 seconds and repeat
          when count is 10 quit
          count = 5
          Sleep 3 seconds and repeat
          when count is 10 quit
          count = 6
          Sleep 3 seconds and repeat
          when count is 10 quit
          count = 7
          Sleep 3 seconds and repeat
          when count is 10 quit
          count = 8
          Sleep 3 seconds and repeat
          when count is 10 quit
          count = 9

          C:\batextra>