0

I'm trying to capture the time before I execute a command. Up to now, I have this code (I am using Windows 7 Pro) :

time < nul | findstr  /r [0-9][0-9]*.*$

The above prints:

The current time is: 13:02:23.89

My questions are:

1) How do I get rid of the "The current time is: " string?

2) How do I assign the remaining value 13:02:23.89 to a variable?

Unfortunately, I cannot put other utilities in this computer, such as resource kits, cygwin, powershell, and other third-party executables. The solution must involve just DOS batch commands.

Thanks.

1 Answer 1

2

echo %time% - there is already variable holding current time :-)

For more - help set

Sign up to request clarification or add additional context in comments.

1 Comment

Yes, my bad! I found about it after I posted. Too late!! But thanks a lot for your help too

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.