Reputation: 388
Can someone explain what these batch commands do?
for /f "tokens=2*" %%A in ('REG QUERY "HKCU\Environment" /v timestamp ^|FIND "timestamp"') DO set timer=%%B
Upvotes: 2
Views: 162
Reputation: 36688
The "tokens=2*"
part will take the text it's passed and split it into "tokens" (by default, space-separated words). It will then take all the words, starting with the second, and pass them in turn to variables with names starting with %%A
; %%A
will get word 2, and %%B
will get the rest (word "*", if you like). See here for more details.
The REG QUERY ... /v
part looks up values in the registry. Since this page has plenty of information about how to use it, I won't go into more extensive detail.
The FIND
command just searches for a text string in the output of the REQ QUERY
part, using pipes to redirect the output of REQ QUERY
to the input of FIND
. See here for more detail about pipes.
The net result of this line in a batch file is to search the registry for any timestamp values under HKEY_CURRENT_USER\Environment
, and assign them to the batch variable timer
.
Upvotes: 7