Community Forums
Results 1 to 2 of 2

Thread: Windows PATH Limits

  1. #1
    Join Date
    Jul 2003
    Location
    Bedford, MA USA
    Posts
    121

    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

  2. #2
    Join Date
    Jul 2003
    Location
    Bedford, MA USA
    Posts
    121
    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).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •