Capture Sys Clock Seconds In Var?

Microsoft Windows 7 home premium
November 25, 2010 at 17:35:52
Specs: Windows 7, AMD Athlon x2/4GB
I can do this myself but I am to busy and wanted to see if someone can post the code which will allow for the capture of the computer's system clock seconds into a variable. The idea here is to use the system clock's seconds as a random generator...hence by dropping the capture into var one can play with random in a different way than the typical global random variable.

Much thanks!, if not I will post the code myself eventually : )


See More: Capture Sys Clock Seconds In Var?

Report •


#1
November 25, 2010 at 18:38:30
Okay I figured it out myself:

---- CODE TO CAPTURE SYSTEM SECONDS ----

echo %time:~5,3%

---TO STORE INTO A VARIABLE-------
set var=%time%
set var1=%time:~5,3%
echo %var1%

------ END -----

The 'var1' would be your container holding the system seconds number data. Of course loops may be employed in order to get random numbers. This is a nice alternative to the limited 'random' global variable.

For those who are not familiar with the symbols, the character: ~ basically says that the numbers which follow it are unary numbers...that is, numbers that have a 'place-location' value as opposed to a sum value...so the 5 and three have to do with digit locations across the time spectrum (00:00:00).

David,
nuevaware.com



Report •

#2
November 25, 2010 at 19:31:59
I'm not really what the point was of setting the first var, you didn't even use it.

And what was wrong with the %Random% variable? You can use a slightly different method:

SET /a Var=%Random%%%100+10
ECHO %Var:~0,2%

Can I put a question here?


Report •

#3
November 26, 2010 at 17:11:53
(there always has to be a smart mouth in the pack)
For your information these are just sketches...nobody is saying unused variables are being used...my gosh...this is exactly why I HATE freakin forums...next time try not to jump the gun...people aren't as stupid as you think they are.

Report •

Related Solutions

#4
November 26, 2010 at 17:55:27
(there always has to be a smart mouth in the pack)

Sorry? I was just adding to what you had. If it came across rude, my apologies.

nobody is saying unused variables are being used...

Then why bother setting them? It's best not to confuse somebody who isn't may not be as experienced as you.

this is exactly why I HATE freakin forums

Hate is a strong word. If you truly hated them, you wouldn't be here. That said though, please don't disappear because of something you took the wrong way. This forum isn't like most, what you get here are:

1) OP's that think we are psychic
2) OP's that must think we are being payed and for some reason assume we HAVE to help them
3) and us, the people that have to deal with the ones in 1 & 2

To be hinest there really is little "social-posting" in these sub forums. The lounge you might see a little more.

people aren't as stupid as you think they are.

Again, I was just adding to what you already had. I assuming anything. I've seen what you've posted and you seem to know what you are talking about.

Me on the other hand; I've posted some weird things (that will usually work) that have a much simpler solution.

Can I put a question here?


Report •


Ask Question