[SOLVED][BAT] Quick help with this - User input to Registry

Discussion in 'Application Software' started by IAmTheDude, Oct 3, 2015.

  1. IAmTheDude

    IAmTheDude MDL Member

    Oct 12, 2011
    112
    19
    10
    #1 IAmTheDude, Oct 3, 2015
    Last edited: Oct 3, 2015
    Hey all!

    Looking for some help with this, I am new to batching and have no clue as to what it would be called to do any searching!

    Basically, I've created a custom .msp to install Office with which I run from the batch.

    OCT only allows the setting of the Organization name and not the Username.

    I would like to be able to have a prompt in the batch to ask for the desired Username and then have that inserted into the registry.

    I have the reg key for it and can manually do it via merging a .reg but that needs editing beforehand and would like it to be interactive in the batch.

    I know how to merge a .reg via batch as well so if it cant be done inside the script is there a way to get the batch to write the .reg for me using the inputted Username?

    Could someone kindly help us out or push us in the right direction?

    Many thanks!
     
  2. KNARZ

    KNARZ MDL Addicted

    Oct 9, 2012
    865
    447
    30
    #2 KNARZ, Oct 3, 2015
    Last edited by a moderator: Apr 20, 2017
    Code:
    @echo off & cls
    set RegKey=HKCU\Office - INSERT THE KEY
    set RegValue=UsernameValue - INSERT VALUE
    set RegType=REG_SZ - IF OTHER THAN DEFINE IT HERE
    
    echo Please type your chosen Username:
    set /p RegData=
    echo Chosen Username is: %RegData%
    
    reg add "%RegKey%" /v "%RegValue%" /t %RegType% /d "%RegData%" /f
    
    timeout.exe /t 5 > nul
    exit
    
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. IAmTheDude

    IAmTheDude MDL Member

    Oct 12, 2011
    112
    19
    10
    There are no words or emojis to express my thanks!

    That's fantastic!
     
  4. KNARZ

    KNARZ MDL Addicted

    Oct 9, 2012
    865
    447
    30
    :smokecowboy:
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...