Discover OS language and architecture of Windows 7 using command prompt

The problem: in a bat file a need make different think based on language an os architecture of windows 7 (are different setup program to be running).
Something like this:
IF OSLanguage = 1033 AND OSArchitecture == 32-bit DO
IF OSLanguage == 1033 AND OSArchitecture == 64-bit DO
and so on....
I have tried with this script:
FOR /f "tokens=1,2 delims==" %%A IN ('"wmic os get OSArchitecture,OSLanguage /format:list"') DO (
 IF /I %%A == "OSArchitecture"  SET MyArch = %%B
 IF /I %%A EQU "OSLanguage" SET MyLCID = %%B
ECHO %MyArch%
ECHO %MyLCID%
Result:
There are many blank row in the result of the wmic command (this is curiosity not problem)
%%A and %%B are well compiled (if I use ECHO %%A and ECHO %%B  inside the do the value are displayed)
%MyArch% and %MyLCID% are empty
Thanks for any idea
LSo
LSo Lorenzo Soncini Trento TN - Italy

I have resolved the first issue. Now with the script:
for /f "tokens=2 delims==" %%A in ('wmic path win32_OperatingSystem get OSLanguage /Value') do set LSOLCID=%%A
for /f "tokens=2 delims==" %%A in ('wmic path win32_OperatingSystem get OSArchitecture /Value') do set LSOARCH=%%A
ECHO Language: %LSOLCID% - Architecture: %LSOARCH%
I have the right answer and the correct value in the 2 variable.
Now if I use this function:
IF /I {%LSOARCH%} == {32 bit} goto :32BIT
IF /I {%LSOARCH%} == {64 bit} goto :64BIT
I receive the error "bit} is unexpected." (In Italian is "bit} non atteso.")
If I use
IF /I %LSOARCH% == 32 bit goto :32BIT
IF /I %LSOARCH% == 64 bit goto :64BIT
the error is  "bit is unexpected." (In Italian is "bit non atteso.")
My hipotesys is some character wrong inside the %LSOARCH%. But if I use something like this:
SET _prefix = %LSOARCH:0,2%
and made the if
IF /I %_prefix% == 32 GOTO :32BIT
I receive the same error (ECHO %_prefix% tell me correctly the value of 32)
I use Windows 7 SP1 Professional 32 bit Italian
LSo
LSo Lorenzo Soncini Trento TN - Italy

Similar Messages

  • How to compile & run using command prompt

    Hi all,
    I have a java application consisting of 3 packages & a jar file in the following hierarchy:
    -Project
    -classes
    -src
    -package1
    -package2
    -package3
    -file.jar
    The main class exists in package2 and uses classes within file.jar
    I want the steps to compile and execute the project using command prompt in windows such that the generated classes will be saved in the classes directory
    Can anyone help?
    Thanx in advance

    Hey,
    If your source(*.java) files are in src folder and ur currnet directory is project
    and you want all your class files to be classes folder then you can try this :
    c:\project>javac -cp src\file.jar -d classes\ src\*.javaAssuming that your file.jar file is in src folder.
    The above command will set the classpath to src\file.jar (-cp src\file.jar)
    -d classes\ - will generate all your class files with package hierarchy if any into classes directory.
    src\*.java - specifies the files to be compiled.
    Hope this helps.

  • How to trace changes in directories and files in windows using java.

    Hi,
    Want to know how to trace changes in directories and files in windows using java.
    I need to create a java procedure that keeps track of any changes done in any directory and its files on a windows System and save this data.
    Edited by: shruti.ggn on Mar 20, 2009 1:56 AM

    chk out the bellow list,get the xml and make the procedure.....     
         Notes          
    1     Some of the similar software’s include HoneyBow, honeytrap, honeyC, captureHPC, honeymole, captureBAT, nepenthes.     
    2     Some of the other hacking software’s include keyloggers. Keyloggers are used for monitoring the keystrokes typed by the user so that we can get the info or passwords one is typing. Some of the keyloggers include remote monitoring capability, it means that we can send the remote file across the network to someone else and then we can monitor the key strokes of that remote pc. Some of the famous keyloggers include win-spy, real-spy, family keylogger and stealth spy.          
    3     Apart from theses tools mentioned above there are some more tools to include that are deepfreeze, Elcomsoft password cracking tools, Online DFS, StegAlyzer, Log analysis tools such as sawmill, etc.

  • Installing Reader or Flash player on Windows 7 and I get a blank command prompt screen that does nothing. Help please.

    Installing Reader or Flash player on Windows 7 and I get a blank command prompt screen that does nothing. Help please.

    Try using the offline installers.
    Adobe Reader: http://get.adobe.com/reader/enterprise/
    Flash Player for Internet Exporer - ActiveX
    Flash Player for Firefox - NPAPI

  • After upgrading to Firefox 8 for mac osx I am unable to close a browser window using command w, or command shift w?

    Hi there,
    After upgrading to Firefox 8 for mac osx I am unable to close a browser window using command w, or command shift w?
    Is there any way I can correct this as it is very annoying?
    Cheers
    Guy
    imac 2.93 GHz Intel Core i7
    osx 10.6.8

    It only happens for me on pages where I've allowed some Flash element to play (I have Flashblocker) such as a YouTube video.

  • How to use addKeyListener in a program running using command prompt

    Does anyone have any idea how to add the addKeyListener to a program running using command prompt.
    Let me explain how the program run.
    The program is start and accept call from other program. But from time to time, I need to issue some command by pressing the keyboard, let say, ESC is closed the program, F1 is showing the stated. F2.... (This is all need to run in the command prompt windows)
    My problem is this program does not have any gui interface, so how can it be added?
    i do it this way
    public void key(){          
    addKeyListener(this);
    But it have compile error.
    mainServerImpl.java:87: cannot resolve symbol
    symbol : method addKeyListener (mainServerImpl)
    location: class mainServerImpl
    addKeyListener(this);
    I did implement KeyListener. But just don't know how to solve this error.
    can anyone tell me how to solve it or point me a source that can help.
    Thank in advance!
    Regards,
    Tai Tan

    Write your own Thread, to do this:
    public class KeyThread extends Thread {
       public void run {
          while(true) {
             int i = System.in.read();
             if(i == 123) {
                break; // to stop the thread
    // in your main:
    Thread keyThread = new KeyThread();
    keyThread.start(); // calls run() of the thread

  • Running a Program in JDeveloper using Command Prompt

    Hi,
    I downoladed Oracle JDeveloper 10g. I had written a simple java class called Echo. java. I want to run the file using command prompt. My JDK has the following path:
    F:\Sowmya
    My java file has the following path:
    F:\Sowmya\jdev\mywork\1\1\src\pkg1
    So, in order to compile the file, I gave the following command:
    F:\Sowmya\jdk\bin>javac F:\Sowmya\jdev\mywork\1\1\src\pkg1\Echo.java
    It worked and the Echo.class file was created.
    But, when I tried to run the file using the following command,
    F:\Sowmya\jdk\bin>java F:\Sowmya\jdev\mywork\1\1\src\pkg1\Echo
    Iam getting the following error:
    Exception in thread "main" java.lang.NOClassDefFoundError: F:\Sowmya\jdev\mywork\1\1\src\pkg1\Echo
    This didnt work either:
    F:\Sowmya\jdk\bin>java F:\Sowmya\jdev\mywork\1\1\classes\pkg1\Echo
    Iam getting the same error.
    Can any one please help me regarding this.
    Thank you,
    Sowmya.

    Yes, my class contains a main. It runs if I click run in JDeveloper. But, there is no output displayed. The following is the code:
    public class Echo {
    public static void main (String[] args) {
    for (String s: args) {
    System.out.println(s);
    }

  • Uninstalling bulk dll's from gac folder at one time using command prompt

    Hi All,
    I need to unistall bulk dll's at a time from the GAC folder using command prompt ,can any one suggest how to do this.

    Hi,
    1. Create a batch file as "Uninstall.bat".
    2. Edit this file and copy the below statements in it:
    gacutil.exe /uf DLL1
    gacutil.exe /uf DLL2
    gacutil.exe /uf DLL3
    gacutil.exe /uf DLL4
    gacutil.exe /uf DLL5
    replace DLL1 to DLL5 with your actual DLL names, which you want to uninstall.
    3. Open Visual Studio Command Prompt as Administrator.
    4. Browse to the location where you have placed the above batch file.
    5. Run the batch file.
    Hope this will help.
    HTH,
    Sumit
    Sumit Verma - MCTS BizTalk 2006/2010 - Please indicate "Mark as Answer" or "Mark as Helpful" if this post has answered the question

  • Can i login to essbase console by using command prompt

    Hi All,
    Is thr any possiblity to login in to essbase console by using command prompt
    normally we login to console and will give credentails and login as same way can we do from command prompt??
    Thanks in advance
    Regards,
    SM

    Hello ,
    You can check the login through the Essbase command utility.
    go to command prompt . type - essmsh
    then you will be able to see MaxL prompt
    enter the command login username password;
    you can use this utility to load data , import export running calc etc...
    Thanks,
    KKT

  • Using command prompt with Java

    I am trying to use command prompt within a java program and I can't figure out how to enter commands from java. I know how to start up command prompt but can someone guide me on a way to actually enter commands into the command prompt? Thanks.

    The Java� Tutorial - Lesson: Basic I/O
    ~

  • How to run ODI scenario using command prompt

    Hi expets
    Please let me know if we can run ODI scenario using command prompt or any way other than operator.
    Regards
    Janakiram

    Go to <ODI_HOME>/oracledi/bin in command prompt and invoke startscen command with teh below parameters.
    Edited by: Guru Sankar on Feb 28, 2011 4:19 PM

  • Using command prompt for help generating

    Hi all!
    Can I use command prompt for generating webhelp instead of
    RoboHelp HTML environment?
    thank you

    See this recent post.
    Click
    here.

  • Microsoft is Office Home and Student 2010-Windows used with macbook pro

    can home and student 2010 be used with my macbook pro?

    can home and student 2010 be used with my macbook pro?

  • Manual startup/shutdown of  windows services using command prompt or .bat

    Hi,
    I know that we could shutdown and start of SAP in windows using the following commands in a .bat file.
    SAP:
         stopsap name=<SID> nr=<SYSNR> SAPDIAHOST=<host>
         startsap name=<SID> nr=<SYSNR> SAPDIAHOST=<host>
    OS Collector:
         saposcol -k
    Oracle Listener:
         lsnrctl stop / start
    How about the following services: 
         SAPDEV_00
         OracleOraHome92Agent
         OracleServiceDEV
    How can I stop and start of these services in a batch file?
    thanks,
    kbas

    Try,
    net stop <service name>
    net start <service name>
    Message was edited by:
            Bidwan Baruah

  • Windows 7 Starter, System Image Failure and Error 0x80070715 results in Command Prompt

    Dear all
    Hi. My laptop CPU is 1.8 GHz, RAM 1 GB, Windows 7 Starter 32-Bit, hard drive: 30 GB for System, antivirus: Microsoft Security Essentials. Creating system image in Windows 7 does not progress in my laptop so I typed regsvr32
    /i swprv.dll in
    administrator command prompt, the result was error: 0x80070715.
     Stop/ Start VSC in Services menu, typing command SFC in adm. Command Prompt, and Clean Boot all were unsuccessful.
    Would you do me a favour about this issue, please?
    Kind regards

    I have the same issue.  
    I am following a Microsoft procedure to re-register DLLs to resolve a VSS error.   At this point, an error occurred. I did:
    > net stop vss
    > net stop swprv
    > regsvr32 ole32.dll
    > regsvr32 vss_ps.dll
    > vssvc /register
    > regsvr32 /I swprv.dll
    Error:
    The module "swprv.dll" was loaded but the call to DllRegisterServer failed with error code 0x80070715.
    For more information about this problem, search online use error code as a search term."
    Windows 7 pro 64-bit.

Maybe you are looking for