command line prompt showing how long last command took?

S

sillyhat

Hello

I sometimes use a prompt like this:


PROMPT=$D $T$H$H$H [$P]$_$G$S


which gives me this:


Fri 2006-05-12 16:55:32 [H:\]



I would like to be able to have something like this:

Fri 2006-05-12 16:55:32 (00:00:00.34) [H:\]


where the time in bracket is the time taken to execute the last
command.

There is an option under some unix shells to do this.


Is it possible in XP? I know from isssuing a 'prompt /?' that there is
no direct way of doing it but perhaps there is some undocumented way.


If not, I'll stick to TIMETHIS.EXE

This was previously posted in: microsoft.public.windowsxp.general
where it was suggested I post the query here.

Thanks in advance.

Hal
~~~~~~~~~~~~~~~~~~~~~
 
T

Timo Salmi

I would like to be able to have something like this:
Fri 2006-05-12 16:55:32 (00:00:00.34) [H:\]
where the time in bracket is the time taken to execute the last
command.
Is it possible in XP? I know from isssuing a 'prompt /?' that there is
no direct way of doing it but perhaps there is some undocumented way.

Prompt I don't know, but in scripting which is the main topic around
here:
30} Can one calculate the difference between two times in a script?
163586 May 1 2006 ftp://garbo.uwasa.fi/pc/link/tscmd.zip
tscmd.zip Useful NT/2000/XP script tricks and tips, T.Salmi


All the best, Timo
 
H

heathsnider

@ECHO OFF
SETLOCAL ENABLEEXTENSIONS
:: Store start time
FOR /f "tokens=1-4 delims=:.," %%T IN ("%TIME%") DO (
SET StartTIME=%TIME%
SET /a Start100S=%%T*360000+%%U*6000+%%V*100+%%W
)

:: Main Batch code goes here
:: Wait for 3 seconds to simulate Batch processing
ping -n 3 127.0.0.1>NUL

:: Retrieve Stop time
FOR /f "tokens=1-4 delims=:.," %%T IN ("%TIME%") DO (
SET StopTIME=%TIME%
SET /a Stop100S=%%T*360000+%%U*6000+%%V*100+%%W
)

:: Test midnight rollover. If so, add 1 day=8640000 1/100ths secs
IF %Stop100S% LSS %Start100S% SET /a Stop100S+=8640000
SET /a TookTime=%Stop100S%-%Start100S%

ECHO. (%~nx0) Started: %StartTime%
ECHO. (%~nx0) Stopped: %StopTime%
ECHO. (%~nx0) Elapsed: %TookTime:~0,-2%.%TookTime:~-2% seconds
 
P

Peter.H.M.Brooks

That's amazing - I was just looking for the msdos version of the 'time'
command and, what do I find, but a usenet group with it as the most
recently posted topic - spooky!
 
T

Todd Vargo

If it was at all worth the effort, one could use http://groups.google.com but I suspect you enjoy arguing and name calling to prove your point. WHATEVER!

"David Candy" <.> wrote in message
Where?

<bitmap removed>
 
T

Thorsten Kampe

* Todd Vargo (2006-05-29 23:26 +0000)
If it was at all worth the effort, one could use http://groups.google.com but I suspect you enjoy arguing and name calling to prove your point. WHATEVER!

Well, his Outlook-Express-Screenshot definitely proved that there /was
no original message/, didn't it? *ROTFL*
 
T

Todd Vargo

Thorsten Kampe said:
* Todd Vargo (2006-05-29 23:26 +0000)
http://groups.google.com but I suspect you enjoy arguing and name calling to
prove your point. WHATEVER!
Well, his Outlook-Express-Screenshot definitely proved that there /was
no original message/, didn't it? *ROTFL*

Your remarks do not prove any more helpful.
Sorry, I don't see anything to *ROTFL* about. :(
 
T

Thorsten Kampe

* Todd Vargo (2006-05-30 16:58 +0000)
http://groups.google.com but I suspect you enjoy arguing and name calling to
prove your point. WHATEVER!

Your remarks do not prove any more helpful.
Sorry, I don't see anything to *ROTFL* about. :(

Well, someone calls another poster a "grade A idiot". When he gets a
reply that suggests that it's obviously the other way round, he sends
a *screenshot* of his *Outlook Express* newsreader suggesting "hey,
look, I can see no original message, there is no original message".

If he would have thought for a second he would have figured out that
the original message must have been the one without a "Re: ". And this
in a ".admin" newsgroup where the level of clue should be a bit above
the average clue level of Microsoft newsgroups.

Well, I call this funny but others may find this even sad. Anyway,
this thread is already more than dead.

Thorsten
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top