Reg add - contetnt of a txt file

Posted on 2011-10-17
Last Modified: 2012-08-13

I would like to add a reg value with a bat file, but I would like to add the content of the txt file (not the filename...). How can this be done?

reg add "HKLM\SOFTWARE\product\123\settings" /v "Text value" /d "c:\test.txt" /f

This gives me c:\test.txt in the registry, and that is not what I want.
Question by:ako74
    LVL 11

    Expert Comment

    And what do you have in this txt file?

    Author Comment

    I run a script on this PC collecting some information about user and local PC. So it is a combination of data in the txt file.
    LVL 11

    Assisted Solution

    As far as I know, this is not possible. But you can add user information in registry with same script that you are using for collecting data.
    LVL 13

    Accepted Solution

    LVL 76

    Assisted Solution

    What do you want to add?
    Are you looking to add the contents of the c:\test.txt file as the data?
    /d is the data that will be set.
    You likely need to use VBscript to get the data out of the file and then create the entries and you may as well use the vbscript API tie in into the registry,
    LVL 43

    Expert Comment

    by:Steve Knight
    It is quite possible to get the data out of a text file and then use it in a reg.exe command.... but then this has already been marked as answered?!

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    Sometimes a user will call me frantically, explaining that something has gone wrong and they have tried everything (read - they have messed it up more and now need someone to clean up) and it still does no good, can I help them?!  Usually the standa…
    I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension ( This reminded me of questions tha…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    731 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now