Bat script for batch modification of registry

background

In the Horizon desktop environment, sometimes it is necessary to modify the desktop image registry to achieve template optimization. However, in the production environment, the scene is changeable, and it is inevitable that a batch of desktop registry needs to be modified in batches. How to achieve this, this article will introduce how to use domains Policy configuration boot scripts execute batch modification of a set of desktop registry key values ​​in the tenant environment.

Registry operations

1. Registry operation

The registry operation is realized with the help of the reg command. The reg command syntax is as follows (reg /?):

REG Operation [Parameter List]

Among them: the
operator includes: [QUERY | ADD | DELETE | COPY | SAVE | LOAD | UNLOAD | RESTORE |COMPARE | EXPORT | IMPORT | FLAGS]

Return code after executing the command: (except REG COMPARE): 0-success; 1-failure

2. New item value:

C:\Users\Administrator>reg add "HKEY_CURRENT_USER\cp%date: 0,4%%date: 5,2%%date: 8,2%%time: 0,2%\1"
operation completed successfully.

The above command is to create one under the current user. \cp\ Take the first 4 digits of the current period (that is, the year, take 4 characters from 0) \ Take 2 characters from 5 \ Take 2 characters from the 8th digit \1 branch, the effect is as follows:
Insert picture description here

Guess you like

Origin blog.csdn.net/ximenjianxue/article/details/114751680