Computing Staff
  • 0

Put A Time Limit On The .BAT

  • 0

Hi,

Ok i have two .BAT files. The first one i set up so it ask for a password, if that password is wrong it loops round asking for it again. Once the correct password is entered it triggers the second .BAT which is a variation of the ‘Matrix Batch File’.

The ‘Matrix Batch File’, if your unaware of it, just runs through random numbers at a high speed and look asif the PC is decoding something. This batch file never ends, it just keeps going.

What i want to do is bring it to an end, say after 10 seconds! but i am unsure of how to go about it. Would you be able to help me?

Coding for ‘Matrix Batch File’ == :

@echo off
title System Decryption
:start
color 00
echo %random%%random% %random%%random% %random%%random% %random%%random% %random%%random% %random%%random%
goto start

I dont think you would need the coding for the Password BAT but i can post it if you want

Thanks

Matt

Share

3 Answers

  1. In place of the SET /A logic, how about:
    (untested)

    @echo off
    title System Decryption
    color 00
    for /L %%A IN (1,1,4000) DO (
    echo %random%%random% %random%%random% %random%%random% %random%%random% %random%%random% %random%%random%
    )
    cls
    title Decypted Intelligence
    echo Decrypted Intelligence: 173a region street, ADVANCE on TARGET at 08:13
    echo.
    echo please press any key to exit
    pause> nul
    exit

    • 0
  2. To change the pause message you can do:
    @echo off
    title Decypted Intelligence
    colour 00
    cls
    echo Decrypted Intelligence: 173a region street, ADVANCE on TARGET at 08:13
    echo.
    echo please press any key to exit
    pause> nul
    :end

    —-

    Alternatively to prevent the need for an additional window and simply clear the matrix code and show your message, you can change your matrix code:

    @echo off
    title System Decryption
    set /a counta=1
    :start
    if %counta% equ 4000 goto end
    set /a counta=%counta%+1
    color 00
    echo %random%%random% %random%%random% %random%%random% %random%%random% %random%%random% %random%%random%
    goto start
    :end
    cls
    title Decypted Intelligence
    colour 00
    cls

    echo Decrypted Intelligence: 173a region street, ADVANCE on TARGET at 08:13
    echo.
    echo please press any key to exit
    pause> nul
    exit

    • 0
  3. If exact time isn’t a necessity, you can accomplish this by looping through your commands a predetermined amount of times. On my system I found that 4000 loops equaled to approximately 10 seconds.
    See below:

    @echo off
    title System Decryption
    set /a counta=1
    :start
    if %counta% equ 4000 goto end
    set /a counta=%counta%+1
    color 00
    echo %random%%random% %random%%random% %random%%random% %random%%random% %random%%random% %random%%random%
    goto start
    :end
    pause
    ::Put whatever you like to happen here

    • 0