0

how to create batch file which prints current system date and time and also change the permisions (to read only) of the files which are in same directory of that batch file.

i m following this site cmds

i have done this but i want to execute like a for loop after every 1 second of delay

echo %time% %date%

how to add delay to batch file and execute it in infinite loop?

thanks!!

after implementing karl-henrik logic image

2 Answers 2

1

Okay so this does not address your inital problem of the permissions but I interpreted your question that you did not have a problem with that part? If I was misstaken please let me know.

Anyhow, I am sure there are better solutions to this but since I did not know if you had access to powershell, or if you had the need to run this script on Windows XP, this solution should work on Windows XP and later.

:loop
timeout 1 > nul
cls
echo %time% %date%
goto :loop

I hope I got your question right.

Best regards //K-H.

EDIT: Seems that the timeout is made avaliable via a resource pack for Windows XP, but the following should work (I have to get me a Windows XP virtual machine to test on..) (Sorry!)

:loop
ping -n 2 127.0.0.1 > nul
cls
echo %time% %date%
goto :loop
Sign up to request clarification or add additional context in comments.

7 Comments

buddy but "@timeout 1 >nul" is not recognised as external or internal command
Sorry seems that it requires the Windows XP resource pack or something to exist in Windows XP. I'll edit my post. sorry!
actually i m using window 8 and still i m getting 'ping' is not recognised as external or internal command
Okay that is odd..you should have timeout too in that case, are you using an account with limited rights or similar? Please see this old Stackoverflow post, perhaps it will help - stackoverflow.com/questions/12412000/…
ur correct bro the account i m using don't have admin rights :) .... let me test this with admin account :) ...thanks
|
0

i believe this is it...

:loop
@cls
@attrib +r *.*
@echo %date% %time%
@timeout 1 >nul
@goto loop

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.