VB Script/.bat

Advertisement


Question
I need to write a .bat script that does this
1. Open the registry editor
2. Go to HKLM\SOFTWARE\Policies\Adobe\\\FeatureLockDown.
3. Create a key called cSharePoint.
4. Create a DWORD value, name it bDisableSharePointFeatures.
5. Set its value to 1.

Answer
Eric,

Using "Reg Add" command you can add a registry key to windows registry.

Syntax:
REG ADD KeyName [/v ValueName | /ve] [/t Type] [/s Separator] [/d Data] [/f]

 KeyName  [\\Machine\]FullKey
         Machine  Name of remote machine - omitting defaults to the
         current machine. Only HKLM and HKU are available on remote
         machines.
         FullKey  ROOTKEY\SubKey
         ROOTKEY  [ HKLM | HKCU | HKCR | HKU | HKCC ]
         SubKey   The full name of a registry key under the selected ROOTKEY.

 /v       The value name, under the selected Key, to add.

 /ve      adds an empty value name (Default) for the key.

 /t       RegKey data types
         [ REG_SZ    | REG_MULTI_SZ | REG_EXPAND_SZ |
         REG_DWORD | REG_QWORD    | REG_BINARY    | REG_NONE ]
         If omitted, REG_SZ is assumed.

 /s       Specify one character that you use as the separator in your data
         string for REG_MULTI_SZ. If omitted, use "\0" as the separator.

 /d       The data to assign to the registry ValueName being added.

 /f       Force overwriting the existing registry entry without prompt.

Examples:

 REG ADD \\ABC\HKLM\Software\MyCo
   Adds a key HKLM\Software\MyCo on remote machine ABC

 REG ADD HKLM\Software\MyCo /v Data /t REG_BINARY /d fe340ead
   Adds a value (name: Data, type: REG_BINARY, data: fe340ead)

 REG ADD HKLM\Software\MyCo /v MRU /t REG_MULTI_SZ /d fax\0mail
   Adds a value (name: MRU, type: REG_MULTI_SZ, data: fax\0mail\0\0)

 REG ADD HKLM\Software\MyCo /v Path /t REG_EXPAND_SZ /d ^%systemroot^%
   Adds a value (name: Path, type: REG_EXPAND_SZ, data: %systemroot%)
   Notice:  Use the caret symbol ( ^ ) inside the expand string

Like above there are other commands of "Reg", those are:

REG Operation [Parameter List]

 Operation  [ QUERY   | ADD    | DELETE  | COPY    |
         SAVE    | LOAD   | UNLOAD  | RESTORE |
         COMPARE | EXPORT | IMPORT  | FLAGS ]

Return Code: (Except for REG COMPARE)

 0 - Successful
 1 - Failed

For help on a specific operation type:

 REG Operation /?

Examples:

 REG QUERY /?
 REG ADD /?
 REG DELETE /?
 REG COPY /?
 REG SAVE /?
 REG RESTORE /?
 REG LOAD /?
 REG UNLOAD /?
 REG COMPARE /?
 REG EXPORT /?
 REG IMPORT /?
 REG FLAGS /?

VB Script

All Answers


Answers by Expert:


Ask Experts

Volunteer


Subbu

Expertise

I can answer VB Script questions which are related to Visual Basic / VBA / QTP Scripts.

Experience

8 Years

Education/Credentials
Master of Computer Applications

Awards and Honors
Established Member from QA Forums and Brainbench certification

©2016 About.com. All rights reserved.