With "tokens=4*", you tell "for /f" that you only want the 4th token plus everything (*) following (not delimited anymore). The pipe "|" needs to be escaped with a caret inside a "for" command, so that the shell does not try to pipe the output of " for /f "tokens=4* delims=, " %%a in ('systeminfo.exe" into " find /i "Original Install Date"') do (". "for /f" will run the command in single quotes inside the brackets: systeminfo.exe ^| find /i "Original Install Date", and process each line of the output (with the "find", we've made sure there's only a single one). Since you're only interested in the install date, you can parse systeminfo's output off setlocal for /f "tokens=4* delims=, " %%a in ('systeminfo.exe ^| find /i "Original Install Date"') do ( set InstallDate=%%a set InstallTime=%%b ) echo Install date: %InstallDate% echo Install time: %InstallTime% So to parse systeminfo's output file, you'll need a combination of the "tokens=. It will break down the line into single "tokens" ("words"), separated by one or more delimiter(s). "for /f" allows you to parse a text file or a command's output line by line.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |