Put a time limit on the .BAT

April 29, 2011 at 07:57:40
Specs: Windows 7, i5/4gb
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


See More: Put a time limit on the .BAT

Report •


#1
April 29, 2011 at 16:35:41
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


Report •

#2
April 29, 2011 at 16:53:01
For a better effect what about:

< nul set /p =%random%%random%%random%%random%%random%%random%


Report •

#3
April 30, 2011 at 05:24:28
@viddywell

That works well!! However, it stops and says press any button to continue or something, if i could get it to then get rid of all the random numbers and display a message that would be good. Or even if i could just tell it to open a new CMD window with the message displayed in it! That would be very helpful.

@Judago

where abouts would i insert that? inbetween:

echo (here) %random%


Report •

Related Solutions

#4
April 30, 2011 at 05:55:05
Ok i messed around with it a little bit and linked it to a new window to display the message. Below the message it say "please press any key to continue" again, (because i put 'pause' in the coding) but is there anyway to change that to say maybe "please press any key to exit" and then it would close down both CMD windows?

Heres the coding for the CMD window that pops up after the 'Matrix' one comes to a hault!:

@echo off
title Decypted Intelligence
colour 00
cls
echo Decrypted Intelligence: 173a region street, ADVANCE on TARGET at 08:13
pause
:end



Report •

#5
April 30, 2011 at 06:50:29
where abouts would i insert that? inbetween:

Try it instead of the echo - In other words where you have the echo, but without the echo.


Report •

#6
April 30, 2011 at 09:22:58
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



Report •

#7
April 30, 2011 at 09:44:27
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

When your only tool is a hammer, every problem looks like a nail.


Report •

#8
April 30, 2011 at 09:45:26
Is it possible to have time limits on these two batch files?

The first one i would preferably like the window to disappear after about 20seconds

@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
goto new window
:new window
start "c:\Users\Matthew\Desktop" "c:\Users\Matthew\Desktop\test2.BAT"
pause

The second one i would like to dissappear after about 10 seconds

@echo off
title Decrypted Intelligence
colour 00
cls
echo Decrypted Intelligence: HELP
:menu
pause >10

You see just above where ive put ">10" in bold, well when ever i run the batch with ">10" just after pause if creates some file on my desktop, do you know what this is? The thing is is that when i leave">10" in the coding it takes away the comment 'please press any button to continue' from the CMD window, which i prefer, but its creating needless files on my desktop!


Report •

#9
April 30, 2011 at 09:50:13
Somehow i didnt see your post viddywell, thank you though its elimated the problem of creating files on my desktop.

Would you be able to help with the timing please, as i stated in my last post?

also, ive just run it through from the beginning, using the first bat, which asks for you to enter a password, when enter correctly, it runs the matrix bat, which after 10 seconds runs the final bat which shows the code and says press any key to exit. but when you press any key it doesnt exit??? however, if i run the last bat on its own, when you press any key it does exit!!


Report •

#10
May 1, 2011 at 04:19:45
anything help guys?

Report •


Ask Question