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

Author Topic: Is it possible to delay a batch file invisibly?  (Read 36579 times)

0 Members and 1 Guest are viewing this topic.

Whitebeard1

    Topic Starter


    Intermediate

    Thanked: 2
    • Computer: Specs
    • Experience: Familiar
    • OS: Mac OS
    Is it possible to delay a batch file invisibly?
    « on: October 26, 2013, 10:21:04 PM »
    I know how to delay a batch file with "pause", "timeout" or "ping", but they all show words on the screen when delaying. I want to delay a batch file without any words being showed on the screen. Is this possible?
    Thanks
    Computers follow your orders, not your intentions.

    DaveLembke



      Sage
    • Thanked: 662
    • Certifications: List
    • Computer: Specs
    • Experience: Expert
    • OS: Windows 10
    Re: Is it possible to delay a batch file invisibly?
    « Reply #1 on: October 26, 2013, 11:50:08 PM »
    SLEEP.EXE is what I use when i dont want text, but it will hold the window open and show nothing. But there is no way to hide the window, and I believe that this was intended in its design so that it wouldnt be used early on as a malicious tool as a hidden TSR. If you want something to run hidden and then trigger you can use Windows Scheduled Task Manager or create a macro and compile it as an exe with instructions to operate and not have a window open while its processing whatever. I use Jitbit for making such macros for custom automated mouse/keyboard functionality with redundant processes that otherwise would require a human to manually perform a tedious process.

    http://www.microsoft.com/en-us/download/details.aspx?id=17657

    Geek-9pm


      Mastermind
    • Geek After Dark
    • Thanked: 1026
      • Gekk9pm bnlog
    • Certifications: List
    • Computer: Specs
    • Experience: Expert
    • OS: Windows 10
    Re: Is it possible to delay a batch file invisibly?
    « Reply #2 on: October 27, 2013, 12:28:00 AM »
    This has been talked about a lot. The general  answer is that either you are not a professional or you a malicious thug looking for help in a crime.

    Windows professionals know how to deploy system updates without causing alarm to the users. One way is  to just tell them an update is now in progress.



    Salmon Trout

    • Guest
    Re: Is it possible to delay a batch file invisibly?
    « Reply #3 on: October 27, 2013, 01:47:59 AM »
    I know how to delay a batch file with "pause", "timeout" or "ping", but they all show words on the screen when delaying.

    I don't think he's asking about hidden batch files.

    You can redirect the output of all these commands to NUL which just swallows the console output so that nothing shows on screen. E.g. PAUSE > NUL

    This can be handy with e.g. PAUSE because it means you can replace the standard message with one of your own.

    Example batch script below

    @echo off
    echo 1. Running PING hidden
    echo Approximately 5 second delay
    echo Starting PING.    The time is %time%
    PING 127.0.0.1 -n 6 > nul
    echo Finished PING.    The time is %time%
    echo.
    echo 2. Running PAUSE hidden
    echo Waiting for you to press a key...
    echo Starting PAUSE.   The time is %time%
    pause > NUL
    echo Finished PAUSE.   The time is %time%
    echo.
    Echo 3. Running TIMEOUT hidden
    echo Timeout 10 seconds or when key is pressed...
    echo Please Wait or press a key...
    echo Starting TIMEOUT. The time is %time%
    Timeout /T 10 > NUL
    echo Finished TIMEOUT. The time is %time%
    echo.
    Echo 4. Running TIMEOUT hidden again
    echo Timeout 10 seconds (keypress locked out)
    echo Please Wait...
    echo Starting TIMEOUT. The time is %time%
    Timeout /T 10 /NOBREAK > NUL
    echo Finished TIMEOUT. The time is %time%
    echo.


    Console output...

    1. Running PING hidden
    Approximately 5 second delay
    Starting PING.    The time is  7:42:07.44
    Finished PING.    The time is  7:42:12.48

    2. Running PAUSE hidden
    Waiting for you to press a key...
    Starting PAUSE.   The time is  7:42:12.49
    Finished PAUSE.   The time is  7:42:22.22

    3. Running TIMEOUT hidden
    Timeout 10 seconds or when key is pressed...
    Please Wait or press a key...
    Starting TIMEOUT. The time is  7:42:22.23
    Finished TIMEOUT. The time is  7:42:32.17

    4. Running TIMEOUT hidden again
    Timeout 10 seconds (keypress locked out)
    Please Wait...
    Starting TIMEOUT. The time is  7:42:32.18
    Finished TIMEOUT. The time is  7:42:42.11








    Lemonilla



      Apprentice

    • "Too sweet"
    • Thanked: 70
    • Computer: Specs
    • Experience: Experienced
    • OS: Windows 7
    Re: Is it possible to delay a batch file invisibly?
    « Reply #4 on: October 27, 2013, 07:23:15 AM »
    timeout /t X >nul 2>&1

    will wait for X seconds, allowing the user to break upon pressing any key.   You can add /NOBREAK to disable this feature and only wait the specified number of seconds.

    The >nul will suppress any regular text and the 2>&1 will suppress any error messages.  >nul cannot be removed without changing 2>&1 to 2>nul.

    Timeout is newly available on windows 7, so your scripts will not be backwards compatible.
    Quote from: patio
    God Bless the DOS Helpers...
    Quote
    If it compiles, send the files.

    margame



      Greenhorn

      • Experience: Beginner
      • OS: Windows XP
      Re: Is it possible to delay a batch file invisibly?
      « Reply #5 on: October 27, 2013, 11:09:59 PM »
      I know how to delay a batch file with "pause", "timeout" or "ping", but they all show words on the screen when delaying. I want to delay a batch file without any words being showed on the screen. Is this possible?
      Thanks

      i guess your saying

      Code: [Select]
      @echo off
      ping localhost -n 6 > nul

      console output will be blank for 5 secs.
      -n 6 = 5 secs.

      Whitebeard1

        Topic Starter


        Intermediate

        Thanked: 2
        • Computer: Specs
        • Experience: Familiar
        • OS: Mac OS
        Re: Is it possible to delay a batch file invisibly?
        « Reply #6 on: October 27, 2013, 11:40:19 PM »
        Thanks for the reply guys. And Geek-9pm, I'm not trying to do a crime or anything, I was talking about pausing a batch file without printing out an annoying "press any key to continue"
        Computers follow your orders, not your intentions.

        Whitebeard1

          Topic Starter


          Intermediate

          Thanked: 2
          • Computer: Specs
          • Experience: Familiar
          • OS: Mac OS
          Re: Is it possible to delay a batch file invisibly?
          « Reply #7 on: October 27, 2013, 11:52:15 PM »
          The replies were helpful. I like the >NUL command, very helpful in my batch file.
          Computers follow your orders, not your intentions.

          Geek-9pm


            Mastermind
          • Geek After Dark
          • Thanked: 1026
            • Gekk9pm bnlog
          • Certifications: List
          • Computer: Specs
          • Experience: Expert
          • OS: Windows 10
          Re: Is it possible to delay a batch file invisibly?
          « Reply #8 on: October 28, 2013, 11:37:28 PM »
          Thanks for the reply guys. And Geek-9pm, I'm not trying to do a crime or anything, I was talking about pausing a batch file without printing out an annoying "press any key to continue"
          Didn't mean to say you were. In the past, some have come here asked similar questions and then when the get what the want strangely diaper and never return.
          BTW; There are versions of SLEEP.EXE that give no output. But the >NUL is just as good and gets the job done with tools at hand.   :)