This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallAnywhere
- :
- InstallAnywhere Forum
- :
- Re: Windows PATH Limits
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Sep 19, 2014
09:29 AM
Windows PATH Limits
Hi,
I apologize up front because this is not really an IA question, even though I am dealing with it in an IA installer. I searched the web for answers but got conflicting info (at least I thought so). And I haven't received an answer from my MSDN post so I thought I'd give the IA forum a try.
We have an installer that needs to add some directories to the Windows system environment PATH variable. What is the maximum number of characters PATH can contain? Do I need to care? Assuming I have a HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment registry key with PATH value that contains 1500 characters, running setx MYPATH "%PATH%" in a Win7 command prompt warns me the data being saved is truncated to 1024 characters. Yet there is no issue setting that same MYPATH key in the installer using a Set System Environment Variable or Set Windows Registry action. I guess, because we're dealing directly with the registry?
If I do need to worry about the PATH length, how do I handle an embedded environment variable, say %HOME% (C:\my\home\directory) in my custom code? When I determine the length of PATH, do I use HOME's 20-character expanded string or do I use the 6-character string %HOME%?
-Jeff
I apologize up front because this is not really an IA question, even though I am dealing with it in an IA installer. I searched the web for answers but got conflicting info (at least I thought so). And I haven't received an answer from my MSDN post so I thought I'd give the IA forum a try.
We have an installer that needs to add some directories to the Windows system environment PATH variable. What is the maximum number of characters PATH can contain? Do I need to care? Assuming I have a HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment registry key with PATH value that contains 1500 characters, running setx MYPATH "%PATH%" in a Win7 command prompt warns me the data being saved is truncated to 1024 characters. Yet there is no issue setting that same MYPATH key in the installer using a Set System Environment Variable or Set Windows Registry action. I guess, because we're dealing directly with the registry?
If I do need to worry about the PATH length, how do I handle an embedded environment variable, say %HOME% (C:\my\home\directory) in my custom code? When I determine the length of PATH, do I use HOME's 20-character expanded string or do I use the 6-character string %HOME%?
-Jeff
(1) Reply
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Nov 11, 2014
09:59 AM
FOr closure reasons: After searching the web and a bunch of testing we decided to go with limits of 1024 for XP/Server 2003 (Windows version < 6) and 2048 for Vista/Server2088 + (version >= 6).