Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Dos Regedit

Options
  • 03-02-2010 12:11pm
    #1
    Registered Users Posts: 272 ✭✭


    Does anyone know how to append a value to the Path variable for Local system in dos (bat)

    regedit System Variable.reg "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SessionManager\Environment\%Path%"
    Pause


    this throws an error i know there is ment to be no space in the path name....so when i run it without it justs adds a new system variable called systemvariable


    HELP!


Comments

  • Registered Users Posts: 1,215 ✭✭✭carveone


    You could do this I suppose:

    reg add "HKLM\System\CurrentControlSet\Control\Session Manager\Environment" /v "Path" /d "%PATH%;C:\NEWAPP\BIN" /f

    I think you might need to add a flag: /t REG_EXPAND_SZ
    because the Path has expandable bits in it like %SYSTEMROOT% and the like and I believe reg add will cause the string to be a REG_SZ which would end up in problems...

    You can do a fetch by playing games with the for command:

    like:

    for /F %a in ('reg query "HKLM....etc..."" /v Path') do set origpath=%a

    (%a has to be %%a in a batch file by the way and you might need to mess with tokens and delims in the for. Do a "for /?" for help...)


  • Registered Users Posts: 272 ✭✭hannable80


    worked great THANKS


  • Registered Users Posts: 272 ✭✭hannable80


    Sorry my inital batch worked but the editing a string im having an issue with


    I am checking to see if %a is in the path variable and if so enter a



    P:\NEWSTRING..... It doesnt work !! any ideas

    %a = P:\teststring;
    For %a in ('reg query "HKLM\System\CurrentControlSet\Control\Session Manager\Environment" /v "Path"')
    reg add "HKLM\System\CurrentControlSet\Control\Session Manager\Environment" /v "Path" /d "P:\NEWSTRING;%PATH%" /f
    Pause


  • Moderators, Recreation & Hobbies Moderators, Science, Health & Environment Moderators, Technology & Internet Moderators Posts: 90,852 Mod ✭✭✭✭Capt'n Midnight


    using For %a in a dos batch file to regedit is not the best idea in the word, because if it has a parsing problem , and it will , horrible things can happen


    you should consider windows scripting instead maybe


  • Registered Users Posts: 272 ✭✭hannable80


    tried it cant get it to go over a domain.. WMI and WSH not working....This is going to be called in a logon script on every machine


  • Advertisement
  • Registered Users Posts: 4,468 ✭✭✭matt-dublin


    export the reg key from a machine

    then run a script:

    regedit.exe /s "\\servername\regfile.reg"

    i use this format successfully for registering ODBC connections (system dsn)


  • Moderators, Recreation & Hobbies Moderators, Science, Health & Environment Moderators, Technology & Internet Moderators Posts: 90,852 Mod ✭✭✭✭Capt'n Midnight


    export the reg key from a machine

    then run a script:

    regedit.exe /s "\\servername\regfile.reg"

    i use this format successfully for registering ODBC connections (system dsn)
    LOL Been there , done that


    does autoexec.nt work any more ?


  • Registered Users Posts: 272 ✭✭hannable80


    i cant use that solution, going to be rolled out on alot of PCs.... Too time consuming


  • Closed Accounts Posts: 5,430 ✭✭✭testicle


    path = %PATH%;newdir ???

    You can also set the Path using Group Policy, in Active Directory.


  • Registered Users Posts: 4,468 ✭✭✭matt-dublin


    hannable80 wrote: »
    i cant use that solution, going to be rolled out on alot of PCs.... Too time consuming
    Yes you can, Logon script.

    Also you could possibly use group policy client side preferences to add a Registry Key.


  • Advertisement
  • Registered Users Posts: 4,468 ✭✭✭matt-dublin


    LOL Been there , done that


    does autoexec.nt work any more ?
    I use this in a logon script deployed via group policy, placed in a specific OU in active directory (computer builds and maintenance)

    IE, Deploy windows via WDS, prestage AD Computer account in specific OU. Lg in, run GPUpdate and all my software installs automatically.

    All the suer has to do is login, no profile configuration required.

    All profile information is saved on LAN so moving PCs is even easier!


  • Registered Users Posts: 272 ✭✭hannable80


    I have no idea how to do that! can you point me in the direction of how to do that.....i am usinh kixs so i thing that is different maybe!
    All i really need is the for statement and the string manipulation to be working on the batch file


  • Registered Users Posts: 272 ✭✭hannable80


    any one got any ideas? The group policy's solution i cannot do company policy !


  • Registered Users Posts: 4,468 ✭✭✭matt-dublin


    then how do you expect to run it out over multiple machines?


  • Registered Users Posts: 272 ✭✭hannable80


    using kixs


  • Registered Users Posts: 4,468 ✭✭✭matt-dublin


    never heard of it


Advertisement