1

I'm having a problem with my laptop, it can't resolve the %windir% environment variable. I checked on the net and find that the PATH variable must be under 2024 characters length. Mine is 3145. Problem is, my laptop in a dev machine, with 4 different versions of Visual Studio and 3 of SQL Server and tons of programming tools that all adds their own path in the PATH variable. I can't shrink it or something won't work anymore. I must keep all versions of VS and MSSQL too.

Is there something I can do to work around this problem??

thanks a lot for your time and help

here is my PATH variable:

%SystemRoot%\system32;
%SystemRoot%;
%SystemRoot%\system32\wbem;
C:\Program Files (x86)\Rockwell Software\RSCommon;
C:\Program Files (x86)\Intel\iCLS Client;
C:\Program Files\Intel\iCLS Client;
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0;
C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;
C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;
C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x86;
C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x64;
C:\Program Files\Lenovo\Fingerprint Manager Pro;
C:\Program Files (x86)\Common Files\Lenovo;
C:\Program Files\Intel\WiFi\bin;
C:\Program Files\Common Files\Intel\WirelessCommon;
C:\Program Files\Microsoft SQL Server\100\Tools\Binn;
C:\Program Files\Microsoft SQL Server\100\DTS\Binn;
C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE;
C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn;
C:\Program Files\Microsoft SQL Server\110\DTS\Binn;
C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn;C:\Program Files\Microsoft SQL Server\110\Tools\Binn;
C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio;
C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn;
C:\Program Files (x86)\Common Files\Rockwell;
C:\Program Files (x86)\Microsoft SQL Server\80\Tools\Binn;
C:\Program Files\Microsoft SQL Server\90\DTS\Binn;C:\Program Files\Microsoft SQL Server\90\Tools\binn;
C:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn;
C:\Program Files (x86)\Microsoft SQL Server\90\DTS\Binn;
C:\Program Files (x86)\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE;
C:\Program Files (x86)\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies;
C:\Program Files (x86)\GtkSharp\2.12\bin;
c:\Program Files\Microsoft SQL Server\90\Tools\binn\;
c:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\;
c:\Program Files\Microsoft SQL Server\90\DTS\Binn\;
c:\Program Files (x86)\Microsoft SQL Server\90\DTS\Binn\;
c:\Program Files (x86)\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\;
c:\Program Files (x86)\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\;
C:\Program Files (x86)\Common Files\lenovo\easyplussdk\bin;
C:\Program Files\JAI\SDK\bin;
C:\Program Files\JAI\SDK\bin\Win32_i86;
C:\Program Files\JAI\SDK\GenICam\bin\Win64_x64;
C:\Program Files\JAI\SDK\GenICam\bin\Win32_i86;
C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;
C:\Program Files\Microsoft SQL Server\110\DTS\Binn\;
C:\Program Files\Lenovo\Fingerprint Manager Pro\;
C:\Program Files\Microsoft\Web Platform Installer\;
C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;
C:\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\;
C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;
C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;
C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;
C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\;
C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;%HALCONROOT%\bin\%HALCONARCH%;%HALCONROOT%\FLEXlm\%HALCONARCH%

(newlines added by me)

4
  • 1
    Please post your PATH variable's content. On my machine I have got two VS (not in PATH) and two MSSQL (three paths in PATH), so I doubt that your multiple instance of VS and MSSQL are the problem. Mar 10, 2015 at 14:23
  • You have to shrink it otherwise some of your variables won't work.
    – Ramhound
    Mar 10, 2015 at 14:26
  • Why is VS in the path at all... surely that causes all manner of problems.
    – RJFalconer
    Mar 10, 2015 at 17:06
  • I posted my PATH variable. As you can see, there is a lot of references to VS and MSSQL
    – Dominic
    Mar 11, 2015 at 15:32

3 Answers 3

1

I think you can cleanup your PATH variable and run every IDE (like Visual Studio) in its own "startup script", where you set appropriate PATH variable:

set PATH=%PATH%;C:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn
start "C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe"

In that way you can limit your PATH length.

1

If you need to keep the path shorter, one solution could be to use the ugly 8.3 MS-DOS style names, i.e., instead of C:\Program Files (x86)\Microsoft Visual Studio 9.0 you could have something like C:\Progra~2\Micros~1.0 (22 characters instead of 50, i.e. 56% shorter). For the actual names, you should check on your system, for example from a command prompt using dir /x. This way the PATH variable will become pretty difficult to read, but should be shortened quite a lot, possibly under the 2024 characters limit, if you have lots of paths with long names.

1

This question is highly relevant: Too many folders in the path variable, and one of the answers suggests using directory junctions as workaround:

Above solution wouldn't work for me, so I went for directory junctions:

  • Select some of the longest paths in my PATH (Like C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\)
  • Create a small folder to store my junctions: c:\d\
  • Create short junctions for long paths:

mklink /j c:\d\sql "C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\"

Doing that on 15 paths reduced my PATH from 2045 to 1285 characters.

It may be a problem when you finally uninstall stuff from your machine as junctions will remain there in the path and you'll have to clean them up manually.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .