How Do I Combine an Environment Variable?

R9I1 61 Reputation points
2024-12-05T13:25:59.25+00:00

How do I combine an environment variable?

Should a combined environment variable be something like this?

“C:\mesa3d-24.0.1-release-msvc\x86” + “C:\mesa3d-24.0.1-release-msvc\x64” = “C:\mesa3d-24.0.1-release-msvc;”

Plus, I use Windows (version 10.0.19045.4894) (64-bit).

Windows for business | Windows Client for IT Pros | User experience | Other
{count} votes

3 answers

Sort by: Most helpful
  1. MotoX80 37,161 Reputation points
    2024-12-06T01:59:29.17+00:00

    so that any directory containing the binary files will work?

    I think that what you are asking is how to append folders to the system path. Correct?

    set path=%path%;C:\mesa3d-24.0.1-release-msvc\x86;C:\mesa3d-24.0.1-release-msvc\x64;C:\mesa3d-24.0.1-release-msvc;
    

    User's image

    Note that this update is not permanent. When you exit the command prompt, or open a new one, you will still have the original path variable.


  2. Anonymous
    2024-12-06T07:37:01.84+00:00

    Hello R9I1

    Thank you for posting in Q&A forum.

    You can add multiple paths to an environment variable by separating them with semicolons. Here's how you can do it:

    1. Open Environment Variables:

    • Right-click on This PC or Computer on your desktop or in File Explorer.

    • Select Properties.

    • Click on Advanced system settings.

    • In the System Properties window, click on the Environment Variables button.

    1. Edit the Path Variable:

    • In the Environment Variables window, find the Path variable in the System variables section and select it.

    • Click Edit.

    1. Add Your Paths:

    In the Edit Environment Variable window, you can add your paths. Each path should be on a new line.

    For example:

    C:\mesa3d-24.0.1-release-msvc\x86

    C:\mesa3d-24.0.1-release-msvc\x64

    Click OK to save your changes.

    Alternatively, if you prefer to combine them into a single line, you can do so by separating each path with a semicolon:

    C:\mesa3d-24.0.1-release-msvc\x86;C:\mesa3d-24.0.1-release-msvc\x64

    I hope the information above is helpful.

    If you have any questions or concerns, please feel free to let us know.

    Best Regards,

    Daisy Zhou

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.

    0 comments No comments

  3. MotoX80 37,161 Reputation points
    2024-12-12T16:55:33.2966667+00:00

    From my experience, I have found that the best solution to a users problem may not have anything to do with the question that they ask about. It would be best if you provide more details and explain what you are trying to do.

    That is, what's the real problem? Are you running a .bat file to do something and it can't find programs in subfolders? Are you running a GUI program? What is the error/issue that you are encountering?

    You have both X86 and X64 folder names listed. If both of those folders contain an executable, let's call it mesa3d.exe for example, how would you (or Windows) know which version (32 or 64) that you wanted to run?

    To allow 32 bit applications to function on 64 bit Windows, MS implemented a file system redirector. This allows 32 bit apps to load the required 32 bit dll's from SysWOW64 even though System32 is listed in the PATH variable.

    https://learn.microsoft.com/en-us/windows/win32/winprog64/file-system-redirector

    https://learn.microsoft.com/en-us/windows/win32/winprog64/wow64-implementation-details

    The issue is that Windows does not know anything about C:\mesa3d-24.0.1-release-msvc. If you had installed the 64bit version of mesa3d into C:\Program Files\mesa3d and the 32bit version into C:\Program Files (x86)\mesa3d, then you might be able to take advantage of the Windows file system redirector. You would need to test that and probably consult with whomever supports mesa3d and find out how to use both 32 and 64 bit versions on a single pc.

    Do you understand how WOW64 works?

    The comment in this StackOverflow post about the "trick" to support both the 32 and 64 bit Oracle clients might be what you are looking for. Then again, there might be a much simpler solution, but you will first need to explain your root issue.

    https://stackoverflow.com/questions/946094/how-can-i-maintain-separate-path-variables-for-32-and-64-bit-applications

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.