Reading the registry from a .bat file

I've searched a bit on web before asking and I apologies a head of time but my knowledge of .bat files is a little lacking. Currently I have a working .bat file I created, but was looking to adding something extra to it and just can't seem to find exactly
what I need.. What i'm looking to do is at the top of .bat file I want it to read the registry here HKEY_LOCAL_MACHINE\SOFTWARE\IS_DEPT\Simage\HW\Platform
Under Platform we either have 2 types LT or DT. (laptop or desktop)
What I want to do is at the top of my bat file have it search this key. If it has the value LT I want it to continue on with the script. If the value is DT I want it to not run the rest of the script and go to :end
If this is possible can someone provide me with the commands to put at the top of the script with also the IF commands to continue or go to :end

Thanks for you reply but I'm still a little lost with the reply.
What is the rest of the commands?
I understand this will query the registry, but what about searching for "LT or DT" and the IF/GOTO Commands?
reg query HKEY_LOCAL_MACHINE\SOFTWARE\IS_DEPT\Simage\HW\Platform
I think my confusion is how to define LT or DT as the variable. I keep finding %errorlevel%  variable, but that seems to only define on (1) or off (0)
Here's what I have so far and I dont' think it's correct.
reg query HKEY_LOCAL_MACHINE\SOFTWARE\IS_DEPT\Simage\HW\Platform /f
if "%ERRORLEVEL%" == "LT" GOTO HOME
if "%ERRORLEVEL%" == "DT" GOTO NOOOOPE

Similar Messages

  • Populate a table reading the data from a TXT file

    how can I populate a table reading the data from a TXT file?
    thanks

    Hey Kevin!
    Using FORMS.TEXT_IO to bulk load data from a file strikes me as re-inventing the wheel. It is just about justifiable in a self-service environment, but I regard the EXTERNAL TABLE is a better solution for that situation as well.
    The same applies to UTL_FILE. I think the ability to read text with UTL_FILE is primarily intended for read file-based configuration or file manipulation/processing rather than data loading.
    Re-writing a text file into SQL statements is too much like hard work (even with an editor that supports macro definition and regular expressions) for no real benefit. You lose all the bulk load peformance you would get from SQL*Loader. But for QAD I'd probably let you off with it.
    You missed out one obvious alternative: using Java to turn the contents of an XML file into a CLOB and inserting it into a table which is read by a PL/SQL procedure that parses the XML records and insert the retrieved data into a table.
    Stay lucky, APC

  • Reading the Registry from Forte

    All,
    I recently needed to add the ability to read values
    from the Windows Registry using Forte. After searching
    through the mailing list archives I discovered that
    several others have needed to do the same but the only
    solution seemed to be to create a C wrapper for the
    Windows API. Currently we do not use a C/C++ compiler
    and did not want to do so just to read the registry.
    The solution I discovered to this problem is simple
    and can easily be added to any Forte application. I
    just wanted to share my idea in the hopes that it will
    help someone.
    The solution is dependent on the Microsoft Windows
    Script Host, which allows native execution of VBScript
    and JScript on a Windows OS. The host can be
    downloaded from Microsoft separately at
    http://msdn.microsoft.com/scripting/. Chances are it
    is already installed on your machine if you have IE5.
    Check the \\windows\ directory for wscript.exe and
    \\windows\command directory for cscript.exe. See the
    site for further details.
    The idea is to run a script (Example script below)
    from Forte using the OperatingSystem.RunCommand and
    redirect the output like this:
    c:\windows\command\cscript.exe //nologo example.js >
    example.ini
    This will produce something like the following:
    [FORTE]
    ForteRoot=c:\forte3L2
    ForteNsAddress=host.name:5000
    ForteModelNode=developer-node
    The redirected file can then be read and parsed.
    Viola! You can access the registry. Afterwards the
    file can be discarded.
    In my implementation I am going to keep a file
    similiar to the example file in a database so I don't
    need to modify code if I change the script (although
    it is hard to get away from that) and I can deploy the
    script to any node I wish (a big plus). You could
    potential deploy the cscript.exe file in the same way
    if you are worried about it not being installed on the
    target machine.
    For my purposes I did not spend the time to create
    classes designed to handle this process (i.e. retrieve
    script, write script to file system, execute script,
    read and parse results, etc.) but it certainly is not
    out of the realm of possibility.
    Well that's about it. Write me if you have any
    questions.
    Samer Kanjo
    What Technology
    skanjoyahoo.com
    Keywords: Registry
    --------------- START EXAMPLE SCRIPT ---------------
    // File: example.js
    // Read and echo some of the Forte environment
    variables. Any registry keys can
    // be accessed. Try it.
    // Note: HKCU = HKEY_CURRENT_USER
    // Run: c:\windows\command\cscript.exe //nologo
    example.js
    var WshShell = WScript.CreateObject("WScript.Shell");
    var forteRoot =
    WshShell.RegRead("HKCU\\Software\\ForteSoftwareInc\\Forte\\FORTE_ROOT");
    var forteNsAddress =
    WshShell.RegRead("HKCU\\Software\\ForteSoftwareInc\\Forte\\FORTE_NS_ADDRESS");
    var forteModelNode =
    WshShell.RegRead("HKCU\\Software\\ForteSoftwareInc\\Forte\\FORTE_MODELNODE");
    WScript.Echo("[FORTE]");
    WScript.Echo("ForteRoot=" + forteRoot );
    WScript.Echo("ForteNsAddress=" + forteNsAddress);
    WScript.Echo("ForteModelNode=" + forteModelNode);
    ---------------- END EXAMPLE SCRIPT ----------------
    Kick off your party with Yahoo! Invites.
    http://invites.yahoo.com/

    Thanks for you reply but I'm still a little lost with the reply.
    What is the rest of the commands?
    I understand this will query the registry, but what about searching for "LT or DT" and the IF/GOTO Commands?
    reg query HKEY_LOCAL_MACHINE\SOFTWARE\IS_DEPT\Simage\HW\Platform
    I think my confusion is how to define LT or DT as the variable. I keep finding %errorlevel%  variable, but that seems to only define on (1) or off (0)
    Here's what I have so far and I dont' think it's correct.
    reg query HKEY_LOCAL_MACHINE\SOFTWARE\IS_DEPT\Simage\HW\Platform /f
    if "%ERRORLEVEL%" == "LT" GOTO HOME
    if "%ERRORLEVEL%" == "DT" GOTO NOOOOPE

  • Is there any way to read the data from an excel file w/o using a loop structure?

    I am retrieving a large amount of data (multiple sheets) from an excel file and would like to extract the entire range without retrieving individual cell values(too slow). I can write an range all at once but cannot read it.

    If you are able to write a block of data, then you should be able to read a block. The four requirements that you want to verify are:
    1. The Range specified must match the exact size and location of the data block you want to read
    2. The returned data is in a 2D array of Variants (either strings or numbers)
    3. Use Variant to Data to convert to 2D DBL or 2D Strings
    4. Check for the correct orientation for your application (use transpose if it is not)
    Michael Munroe
    Certified LabVIEW Developer
    www.abcdef.biz
    Michael Munroe, ABCDEF
    Certified LabVIEW Developer, MCP
    Find and fix bad VI Properties with Property Inspector

  • How to read the data from an excel file into MYSQL by java language

    Hi all,
    I have some data in excel spread sheet and I want to put the data into MYSQL data base. I created the tables in MYSQL> How can I write a program in JAVA that puts the value from excel sheet to mysql??
    I would appreciate your help
    regards

    By typing code at the keyboard... but presumably you meant to ask what code you should type.
    To get data out of Excel there are a few alternatives. The Google keywords I would use to find them are "java excel". I use Apache POI but there are other possibilities, I believe. As for getting the data into MySQL once you have extracted it from Excel, you would use JDBC. But you already knew that, didn't you? You did find the JDBC forum.
    In general it's better to ask a specific question on a forum. If you don't have a clue (which is the way we all start out) then just telling people that isn't going to be helpful. The best you're going to get is links to tutorials, which you could perfectly well have found for yourself by simple web searches.

  • How can i Read the Data from such Excel files?

    Dear All,
            Here I am attaching an excel file in which all the datat cells have more than one data, can anybody tell me, how to read from such kind of excel files?
    Thanks in Advance & Happy New Year,
    Rujuta

    Greetings Ruju,
    Here is what I do to read such a file:
    I first save the Excel file (xls) as CSV file (which is easier to handle: Comma Seperated Values) .. Open the file using Excel and save it CSV.
    Then using the code attached I get all these values in a string array.
    Hope this helps
    Ayman Mohammad Metwally
    Automation Engineer
    Egypt - Cairo
    Attachments:
    CSV2ARRAY.vi ‏29 KB

  • Reading the data from XML Source

    Hi
    i want to read the data from XML source file, and update the transaction information to another XML file. how we can do this in ADF, please help
    Thanks
    nidhi

    you may use normal Java API to do that
    http://www.javablogging.com/read-and-write-xml/

  • How to read configuration data from an xml file (not web.xml)?

    Hi,
    I want to separate the application specific configuration parameters in a separate xml file and read them as and when they are needed? I know that I can use the wb.xml but I want to separate them in a different xml file because I don't want the web.xml file to be played around later after deployment. If any change is needed then it should be done in the application-config.xml.
    How can I read the parameters from this xml file in my jsp code and also what should be the location of this file if I have
    ../webapps/Root/application
    directoty structure ?
    Any help is greatly appreciated.

    can you give an example of a property file and also
    it is loaded in the jsp ?Hmm... loading properties in a JSP is not a very good idea. You should do it in a separate class, rather than mixing the logic with the display logic.
    Properties properties = new Properties();
    properties.load(UtilClass.class.getResourceAsStream("config.properties"));
    // Add a try - catch block around the load
    // for IOException...

  • I have a VI and an attched .txt data file. Now I want to read the data from the .txt file and display it as an array in the front panel. But the result is not right. Any help?

    I have a VI and an attched .txt data file. Now I want to read the data from the .txt file and display it as an array in the front panel. But the result is not right. Any help?
    Attachments:
    try2.txt ‏2 KB
    read_array.vi ‏21 KB

    The problem is in the delimiters in your text file. By default, Read From Spreadsheet File.vi expects a tab delimited file. You can specify a delimiter (like a space), but Read From Spreadsheet File.vi has a problem with repeated delimiters: if you specify a single space as a delimiter and Read From Spreadsheet File.vi finds two spaces back-to-back, it stops reading that line. Your file (as I got it from your earlier post) is delimited by 4 spaces.
    Here are some of your choices to fix your problem.
    1. Change the source file to a tab delimited file. Your VI will then run as is.
    2. Change the source file to be delimited by a single space (rather than 4), then wire a string constant containing one space to the delimiter input of Read From Spreadsheet File.vi.
    3. Wire a string constant containing 4 spaces to the delimiter input of Read From Spreadsheet File.vi. Then your text file will run as is.
    Depending on where your text file comes from (see more comments below), I'd vote for choice 1: a tab delimited text file. It's the most common text output of spreadsheet programs.
    Comments for choices 1 and 2: Where does the text file come from? Is it automatically generated or manually generated? Will it be generated multiple times or just once? If it's manually generated or generated just once, you can use any text editor to change 4 spaces to a tab or to a single space. Note: if you want to change it to a tab delimited file, you can't enter a tab directly into a box in the search & replace dialog of many programs like notepad, but you can do a cut and paste. Before you start your search and replace (just in the text window of the editor), press tab. A tab character will be entered. Press Shift-LeftArrow (not Backspace) to highlight the tab character. Press Ctrl-X to cut the tab character. Start your search and replace (Ctrl-H in notepad in Windows 2000). Click into the Find What box. Enter four spaces. Click into the Replace With box. Press Ctrl-V to paste the tab character. And another thing: older versions of notepad don't have search and replace. Use any editor or word processor that does.

  • How to read the data from Excel file and Store in XML file using java

    Hi All,
    I got a problem with Excel file.
    My problem is how to read the data from Excel file and Store in XML file using java excel api.
    For getting the data from Excel file what are all the steps i need to follow to get the correct result.
    Any body can send me the code (with java code ,Excel sheet) to this mail id : [email protected]
    Thanks & Regards,
    Sreenu,
    [email protected],
    india,

    If you want someone to do your work, please have the courtesy to provide payment.
    http://www.rentacoder.com

  • Regarding reading the data from the files without using Stremas

    hai to all of u...
    here i have a problem where i have to read the data from the files without using any streams.
    please guide me how to do this one,if possible by giving with an example
    Thanks & Regard
    M.Ramakrishna

    Simply put, you can't.
    By why do you need to?

  • Reading the data from excel file which is in application server.

    Hi,
    Iam trying to read the data from excel file which is in application server.
    I tried using the function module ALSM_EXCEL_TO_INTERNAL_TABLE. But it didn't work.
    I tried just reading using open data set and read data set it is giving junk characters.
    Please suggest me if you have any solution.
    Best Regards,
    Brahma Reddy

    Hi Narendra,
    Please see the below code I have written
    OPEN DATASET pa_sfile for INPUT in text mode ENCODING  DEFAULT MESSAGE wf_mess.
    CHECK sy-subrc = 0.
    DO.
    READ DATASET pa_sfile INTO wf_string.
    IF sy-subrc <> 0.
    EXIT.
    else.
    split wf_string at wl_# into wf_field1 wf_field2 wa_upload-field3
    wa_upload-field4 wa_upload-field5 wa_upload-field6 wa_upload-field7 wa_upload-field8
    wa_upload-field9 wa_upload-field10 wa_upload-field11 wa_upload-field12 wa_upload-field13
    wa_upload-field14 wa_upload-field15 wa_upload-field16 wa_upload-field17 wa_upload-field18
    wa_upload-field19 wa_upload-field20 wa_upload-field21 wa_upload-field22 wa_upload-field23
    wa_upload-field24 wa_upload-field25 wa_upload-field26 wa_upload-field27 wa_upload-field28
    wa_upload-field29 wa_upload-field30 wa_upload-field31 wa_upload-field32 wa_upload-field33
    wa_upload-field34 wa_upload-field35 wa_upload-field36 .
    wa_upload-field1 = wf_field1.
    wa_upload-field2 = wf_field2.
    append wa_upload to int_upload.
    clear wa_upload.
    ENDIF.
    ENDDO.
    CLOSE DATASET pa_sfile.
    Please note Iam using ECC5.0 and it is not allowing me to declare wl_# as x as in your code.
    Also if Iam using text mode I should use extension encoding etc.( Where as not in your case).
    Please suggest me any other way.
    Thanks for your help,
    Brahma Reddy

  • How to read the data from a file in another computer with user name and password login

    How to read read the data from a file in anohter computer which need to login with user name and password?

    duplicate post:  http://forums.ni.com/t5/LabVIEW/log-on-the-other-computer-with-user-name-and-password/m-p/2061478
    duplicate post:  http://forums.ni.com/t5/LabVIEW/do-need-to-enter-the-user-name-and-password-when-TCP-ip/m-p/2061612
    duplicate post   http://forums.ni.com/t5/LabVIEW/log-on-the-other-computer-with-user-name-and-password/m-p/2060682

  • What is the 'quickest' way to read char data from a txt file

    Hello,
    What is the 'quickest' way to read character data from a txt file stored on the phone to be displayed into the screen?
    Regards

    To be even a bit more constructive...
    Since J2me does not have a BufferedInputStream, it will help to implement it yourself. It's much faster since you read large blocks at ones in stread of seperate chars.
    something line this lets you read lines very fast:
      while ( bytesread < filesize ) {
             length = configfile.read( buff, 0, buff.length );
             // append buffer to temp String
             if ( length < buff.length ) {
                byte[]  buf  = new byte[length];
                System.arraycopy( buff, 0, buf, 0, length );
                tmp.append( new String( buf ) );
             } else {
                tmp.append( new String( buff ) );
             // look in tmp string for \r\n
             idx1 = tmp.toString().indexOf( "\r\n" );
             while ( idx1 >= 0 ) {
                //if found, split into line and rest of tmp
                line = tmp.toString().substring( 0, idx1 );
             /// ... do with it whatever you want ... ////
                tmp = new StringBuffer( tmp.toString().substring( idx1 + 2 ) );
                idx1 = tmp.toString().indexOf( "\r\n" );
             bytesread += length;
          }

  • Reading an object from a binary file

    i am writing objects into my binary file using printwriter class. i am able to write objects into the file but i am having problems reading the object from the file. is there any other way of going about it. i tried using the objectoutputstream and object input stream class. but i am getting run time errors coz of something to do with serialization
    i am storing records as a object into a binary file so that it is easy to seek my records

    Of course you have trouble reading objects after you wrote them with a PrintWriter.
    You should rather have fixed the Serialization errors: only objkects that implement Serializable correctly can be serialized.

Maybe you are looking for

  • IPod Nano(2nd) problems with Windows Vista

    I'm trying to sync music and podcasts to my Nano and I get an error message (-50) saying it wont sync. Then I get another error message saying that the disk could not be read from or written to. I have the newest version of iTunes and the newest vers

  • Trackpad won't release click immediately after upgrading to 10.6.4

    I haven't been having any problems with my 15"MacBook Pro and I Software Updated to 10.6.4 this afternoon. Now within the first 3 or 4 times I click the Trackpad after rebooting it registers the mousedown but refuses to register the mouseup. Details:

  • Faulty n95 v21 music player?

    hi, Before on v20 (with orig. Nokia 1gb microsd and 2gb microsd), every new music added through nokia music manager will be automatically added to the music player without me refreshing the phone, now a couple of days(maybe weeks)i updated fw (v21) a

  • Iphoto for slideshows or iMovie

    If I want to have songs fade in and transititions, would it better to do a slide show in iMovie? Tracy

  • Not allow loading to specific entities.

    All, I am trying to create a validation which checks a list of entities (defined by me) and tells the loader they are not allowed to load to said entities, like a validation error only thing they see "Inactive Entity/Entities" error. I'm thinking a "