Posts Tagged ‘ Batch ’

Read Registry value into a batch variable

2017/07/06
By
Modified: 2017/06/25
Rue-Sainte-Catherine--2015-

Before I forget, let me share with you a fantastic way to read values from Registry into a batch file variable. Say you need to determine, what is the date format of this machine.  Normally you would read a value from HKEY_CURRENT_USER\Control Panel\International like this: REG QUERY "HKCU\Control Panel\International" /v sShortDate   That command will produce an output similar to this: HKEY_CURRENT_USER\Control Panel\International sShortDate    REG_SZ    M/d/yyyy But you do not need all that.  All you need is the string  “M/d/yyyy” (or “yyyy-MM-dd”).  To get just that string you need to skip to a second line and read third field on the last line.  How you can do that in a batch…

Read more »