Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Find path in the Win Registery  (Read 12239 times)

0 Members and 1 Guest are viewing this topic.

Ryder17z

    Topic Starter


    Intermediate
  • Thanked: 2
    • Yes
  • Computer: Specs
  • Experience: Experienced
  • OS: Windows 10
Find path in the Win Registery
« on: April 13, 2009, 02:05:58 AM »
I have tried to make an installer, but the main problem is that I need some kind of script that does this:

-> Find Path: Sims Installation Folder, searching in the registery (Example: C:\Maxis\The Sims\ - if this is the path stored in the registery)

-> Copy files and folders from:
"drive:\folder2\Sims Complete\"
into:
"drive:\folder\"

Does anyone know how to do it?

The best way to create it would be writing in VB or C++ because I don't think any other language has registery support
The cake is a lie...

Reno



    Hopeful
  • Thanked: 32
    Re: Find path in the Win Registery
    « Reply #1 on: April 13, 2009, 02:59:41 AM »
    reading from registry:
    ----------------------
    batch - use reg.exe
    vbscript - regread method
    wmi  - StdRegProv
    vb6 - access win32 API, and call Reg* API


    i think a better way is to use wmi query in vbs, "select * from win32_product"
    and then wsh.echo .installlocation

    gh0std0g74



      Apprentice

      Thanked: 37
      Re: Find path in the Win Registery
      « Reply #2 on: April 13, 2009, 04:30:04 AM »
      The best way to create it would be writing in VB or C++ because I don't think any other language has registery support
      shouldn't make assumptions like that. modern languages like Perl/Python has support (in terms of libraries) for a lot of things (often better than VB/batch). here's an example of Perl interfacing with the windows registry.
      Code: [Select]
      use Win32::Registry;
      my $Register = "Software\\MICROSOFT\\windows";
      my $hkey;
      $HKEY_LOCAL_MACHINE->Open($Register,$hkey)|| die $!;
      $hkey->GetKeys(\@key_list);
      print "$Register keys\n";
      foreach $key (@key_list)
              {
              print "$key\n";
              }
      $hkey->Close();
      output
      Code: [Select]
      C:\test> perl test.pl
      Software\MICROSOFT\windows keys
      CurrentVersion
      ITStorage

      Ryder17z

        Topic Starter


        Intermediate
      • Thanked: 2
        • Yes
      • Computer: Specs
      • Experience: Experienced
      • OS: Windows 10
      Re: Find path in the Win Registery
      « Reply #3 on: April 13, 2009, 10:56:02 AM »
      Allright...

      I have tried using the REG.exe thing but I haven't found a way to do what i want:

      1. How do I get the data from this key:

      "HKEY_Local_Machine\Software\Maxis\The Sims\InstallPath"

      2. And tell a batch file to copy the files in folder:

      "drive:\folder2\Sims Complete\"

      to the path stored in the registry (specified above)


      A working code would be appreciated
      The cake is a lie...

      Reno



        Hopeful
      • Thanked: 32
        Re: Find path in the Win Registery
        « Reply #4 on: April 14, 2009, 01:30:07 AM »
        reg query "HKLM\software\maxis\the sims"

        reg query "HKLM\software\maxis\the sims" /v "installpath"

        post back the screen result

        mroilfield



          Mentor
        • Thanked: 42
          • Yes
          • Yes
        • Computer: Specs
        • Experience: Experienced
        • OS: Windows 11
        Re: Find path in the Win Registery
        « Reply #5 on: April 14, 2009, 03:02:16 AM »
        Just a question here but why are you trying to make an installer for the Sims? If you have the original disc then it should have the installer on it.
        You can't fix Stupid!!!

        Ryder17z

          Topic Starter


          Intermediate
        • Thanked: 2
          • Yes
        • Computer: Specs
        • Experience: Experienced
        • OS: Windows 10
        Re: Find path in the Win Registery
        « Reply #6 on: April 15, 2009, 03:25:19 AM »
        I have downloaded several objects to it and i want to make it easy to install
        The cake is a lie...

        mroilfield



          Mentor
        • Thanked: 42
          • Yes
          • Yes
        • Computer: Specs
        • Experience: Experienced
        • OS: Windows 11
        Re: Find path in the Win Registery
        « Reply #7 on: April 15, 2009, 03:50:38 AM »
        I have downloaded several objects to it and i want to make it easy to install


        I take it this is not a legitimate copy of the Sims or at least not legitimate objects that you have downloaded. I say this because 99.9% of legitimate items already have easy ways to install.
        You can't fix Stupid!!!

        BC_Programmer


          Mastermind
        • Typing is no substitute for thinking.
        • Thanked: 1140
          • Yes
          • Yes
          • BC-Programming.com
        • Certifications: List
        • Computer: Specs
        • Experience: Beginner
        • OS: Windows 11
        Re: Find path in the Win Registery
        « Reply #8 on: April 15, 2009, 04:16:03 AM »
        he probably created special objects for the sims and wants an installer, so he doesn't have to copy the add-ons himself.

        I was trying to dereference Null Pointers before it was cool.

        Ryder17z

          Topic Starter


          Intermediate
        • Thanked: 2
          • Yes
        • Computer: Specs
        • Experience: Experienced
        • OS: Windows 10
        Re: Find path in the Win Registery
        « Reply #9 on: April 18, 2009, 02:42:33 AM »
        I have bought The Sims Complete Collection, so no illegal with it so far...


        I have...     ...um, let us say about 250 - 800 objects (IFF files) that comes from various sites for The Sims

        And I'm trying to create an installer for them, so I don't have to install them manually


        Since there exist a "InstallPath" key after you install The Sims, it would be easy if my installer uses the path which I mentioned in first post

        reg query "HKLM\software\maxis\the sims"

        reg query "HKLM\software\maxis\the sims" /v "installpath"

        post back the screen result


        I tried them, with same result: Displaying every entry and it's value in "HKLM\software\maxis\the sims\"

        Here is what i get:
        Code: [Select]
        ! REG.EXE VERSION 3.0

        HKEY_LOCAL_MACHINE\software\maxis\the sims
            SIMS_MUSIC REG_SZ d:\
            SIMS_SOUND REG_SZ C:\Program\Maxis\The Sims\SoundData
            SIMS_DATA REG_SZ C:\Program\Maxis\The Sims
            InstallPath REG_SZ C:\Program\Maxis\The Sims
            Version REG_SZ 1.2
            Language REG_DWORD 0x41d
            SIMS_SKU REG_DWORD 0x2
            SIMS_LANGUAGE REG_SZ Swedish
            EPDInstalled REG_SZ 1
            EPInstalled REG_SZ 1
            Installed REG_SZ 1
            EP3Patch REG_SZ 2
            SIMS_GAME_EDITION REG_SZ 255
            TELEPORT REG_SZ 1
            SIMS_CURRENT_NEIGHBORHOOD_NUM REG_SZ 2
            SIMS_CURRENT_NEIGHBORHOOD_PATH REG_SZ UserData2
            EP2Installed REG_SZ 1
            EP3Installed REG_SZ 1
            EP4Installed REG_SZ 1
            EP5Installed REG_SZ 1
            EP6Installed REG_SZ 1
            EP7Installed REG_SZ 1
            EP8Installed REG_SZ 1
            EPDPatch REG_SZ 1
            EP5Patch REG_SZ 1
        The cake is a lie...

        Reno



          Hopeful
        • Thanked: 32
          Re: Find path in the Win Registery
          « Reply #10 on: April 18, 2009, 03:28:04 AM »
          Code: [Select]
          @echo off & setlocal & set sim=

          set q="HKLM\software\maxis\the sims" /v installpath
          for /f "skip=4 tokens=2*" %%a in ('reg query %q%') do set sim=%%b

          if defined sim echo copy *.iff "%sim%"

          Ryder17z

            Topic Starter


            Intermediate
          • Thanked: 2
            • Yes
          • Computer: Specs
          • Experience: Experienced
          • OS: Windows 10
          Re: Find path in the Win Registery
          « Reply #11 on: April 18, 2009, 05:03:34 AM »
          Thanks Reno, it works but I don't understand how :-\

          It copies "filename.iff" to "The Sims\GameData\Userobjects\filename\finename.iff" - which is the correct folder

          How does it get that path, I mean it's not in the script or the registery ? (nothing says "GameData\UserObjects")
          The cake is a lie...

          Reno



            Hopeful
          • Thanked: 32
            Re: Find path in the Win Registery
            « Reply #12 on: April 18, 2009, 07:42:36 AM »
            It copies "filename.iff" to "The Sims\GameData\Userobjects\filename\finename.iff" - which is the correct folder

            what's the one in bold?? is it actual folder name, or you need to extract the info from filename.iff??

            Ryder17z

              Topic Starter


              Intermediate
            • Thanked: 2
              • Yes
            • Computer: Specs
            • Experience: Experienced
            • OS: Windows 10
            Re: Find path in the Win Registery
            « Reply #13 on: April 18, 2009, 08:16:26 AM »
            It copies "filename.iff" to "The Sims\GameData\Userobjects\filename\finename.iff" - which is the correct folder

            what's the one in bold?? is it actual folder name, or you need to extract the info from filename.iff??

            It's a folder name, but I still don't understand how the code actually copy to correct folder
            The cake is a lie...

            Reno



              Hopeful
            • Thanked: 32
              Re: Find path in the Win Registery
              « Reply #14 on: April 18, 2009, 08:48:15 AM »
              Code: [Select]
              if not defined sim goto:eof
              copy "c:\pathto\iff_folder\*.iff" "%sim%\GameData\Userobjects\filename\"


              it's just normal copy operation, type copy/? for help

              Ryder17z

                Topic Starter


                Intermediate
              • Thanked: 2
                • Yes
              • Computer: Specs
              • Experience: Experienced
              • OS: Windows 10
              Re: Find path in the Win Registery
              « Reply #15 on: April 18, 2009, 11:14:38 AM »
              Yes, but if we look at your code:
              Code: [Select]
              @echo off & setlocal & set sim=

              set q="HKLM\software\maxis\the sims" /v installpath
              for /f "skip=4 tokens=2*" %%a in ('reg query %q%') do set sim=%%b

              if defined sim echo copy *.iff "%sim%"
              Nothing tells it to use "The Sims\GameData\Userobjects\filename\filename.iff"

              When I read your code, something tells me the path "The Sims\filename\filename.iff" would be used, which I don't get why isn't

              I mean, Where does it get "GameData\UserObjects\" from?
              It's not even in the script, or defined in the win registery
              The cake is a lie...

              Reno



                Hopeful
              • Thanked: 32
                Re: Find path in the Win Registery
                « Reply #16 on: April 18, 2009, 11:49:31 AM »
                Yes, but if we look at your code:Nothing tells it to use "The Sims\GameData\Userobjects\filename\filename.iff"

                I mean, Where does it get "GameData\UserObjects\" from?
                It's not even in the script, or defined in the win registery
                how would i know where it get the value, why dont you tell me. i am not the one who makes the sim. and i even never play the sims.
                i only post code based on your description, assuming %installpath%\gamedata\userobjects\filename\ is the default folder for iff files. ( see below )
                It copies "filename.iff" to "The Sims\GameData\Userobjects\filename\finename.iff" - which is the correct folder

                Ryder17z

                  Topic Starter


                  Intermediate
                • Thanked: 2
                  • Yes
                • Computer: Specs
                • Experience: Experienced
                • OS: Windows 10
                Re: Find path in the Win Registery
                « Reply #17 on: April 18, 2009, 12:25:43 PM »
                How can I tell you if I don't know the answear? :P


                       The path in the script is different than the actual path used
                                                 /\                                            /\
                                                  |                                             |
                                                  |                                             |
                                        "The Sims\filename.iff"                           |
                                                                                                ||
                                                                                                ||
                                                  "The Sims\GameData\Userobjects\filename\filename.iff"


                I feel confused ???
                The cake is a lie...

                BC_Programmer


                  Mastermind
                • Typing is no substitute for thinking.
                • Thanked: 1140
                  • Yes
                  • Yes
                  • BC-Programming.com
                • Certifications: List
                • Computer: Specs
                • Experience: Beginner
                • OS: Windows 11
                Re: Find path in the Win Registery
                « Reply #18 on: April 19, 2009, 11:16:11 AM »
                change the path in the script to be the actual path used.  ::)
                I was trying to dereference Null Pointers before it was cool.

                Ryder17z

                  Topic Starter


                  Intermediate
                • Thanked: 2
                  • Yes
                • Computer: Specs
                • Experience: Experienced
                • OS: Windows 10
                Re: Find path in the Win Registery
                « Reply #19 on: April 24, 2009, 06:29:11 AM »
                No need to do since it works already, but it works like magic, nobody knows how, they just know it works ::)
                The cake is a lie...

                BC_Programmer


                  Mastermind
                • Typing is no substitute for thinking.
                • Thanked: 1140
                  • Yes
                  • Yes
                  • BC-Programming.com
                • Certifications: List
                • Computer: Specs
                • Experience: Beginner
                • OS: Windows 11
                Re: Find path in the Win Registery
                « Reply #20 on: April 24, 2009, 08:56:09 AM »
                Code: [Select]
                set q="HKLM\software\maxis\the sims" /v installpath


                this takes it from the registry.
                I was trying to dereference Null Pointers before it was cool.