How would i go about storing the time it took to excecute my script into a variable?

any help would be appreciated :)

Recommended Answers

All 6 Replies

See the "time" command.

can you tell me what that is?

type "time" at the command line and check it out.

Then type "man time" at the command line and read that carefully (assuming, of course, that you are using a Unix system, as that is what this forum concerns).

im using win32 :P

Then check in VB and or Batch forums as this forum is for Unix Scripting, as Windows Scripting is referred to as either VB or Batch, not Shell, Scripting.

you can use %time%
when tring to get the %time% var, it changed to the corrent time.
so you can do it on the start:
set BeginTime=%time%
and on the end:
set EndTime=%time%

You can use the NOW command that you can get on the microsoft windows server 2003 resource kit:
http://www.microsoft.com/Downloads/details.aspx?FamilyID=9d467a69-57ff-4ae7-96ee-b18c4790cffd&displaylang=en

You can also play with the strings like that

set PLAYTIME=%DATE:~10,4%-%DATE:~4,2%-%DATE:~7,2%-%TIME:~0,2%-%TIME:~3,2%-%TIME:~6,2%

echo %PLAYTIME%

(i used %date% and %time% and played with the strings....)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.