12 ms·
Environment Variables and Path in Windows 10
- cjslep 11y agoHopefully there is no more maximum length that PATH could be. My last experience was with Windows 7, so maybe a lot has changed since then. Nothing more annoying than having a custom CMD shortcut that loads a script to add things to PATH that got truncated otherwise, and maintaining that script as new programs were installed and wanted to keep adding to PATH.
- userbinator 11y agoas new programs were installed and wanted to keep adding to PATH. That's more a problem with those programs than anything about the length of an environment variable.
- HCIdivision17 11y agoYou're technically correct, but you're really underplaying how goddam troublesome it can be. Just a couple days ago, I tried to add a tool to my PATH and it wouldn't stick because both Intel and Microsoft decided that their utility needed not only both Program Files and Program Files (x86) for each (doubling their PATH usage), but Intel also decided to arbitrarily use positively uselessly long directory names. As in, I actually think it's plausible Intel specifically did it to screw over PATH usage. Infuriatingly, the hard PATH limit is after any environment variables have been expanded, meaning there's no reasonable way to compress the path down. (Never mind that it also only expands variables less than the string 'PATH'.) In the end, I used DIR to find what the 8dot3 representation of each repeated or long directory was. Now I have enough free characters, but no fracking idea exactly where they point. It's the sort of crazy that I really thought would have been lic'd by now. Edit: I forgot to note that the hard limit is a truncation. So while you can happily add to the PATH variable in the (now out-dated) dialog, the actual console won't see all of it. I had moved folders around before my rant above such that my final PATH exactly ended on "\node\bin". It's sort of a weird game of PATH golf at this point for me.
- WorldMaker 11y agoDid you take a look at those Intel binaries they wanted on the PATH? They are all diagnostics tools that so far as I know aren't very useful to the average developer, much less the average consumer. There really doesn't seem to be a reason for Intel to add them to the PATH, because how often do people make support calls directly to Intel? I just remove the Intel folders from my PATH (every time one of their drivers resmashes them into the PATH).
- dragonwriter 11y agoIIRC, it's more a problem with Microsoft making that there preferred way to make programs available in the shell rather than having a well-known user and system level locations places to which symlinks could be placed.
- WorldMaker 11y agoThe preferred way is App Paths [1], it's just that there's not really a good UI for that and most people are used to Unix-style PATH environment variables so a lot of software depends on that that maybe doesn't actually need to and a lot of installers are built for that because the person building the installer didn't find the App Path tools but did find the Environment Variable smasher. [1] http://blogs.msdn.com/b/oldnewthing/archive/2011/07/25/10189298.aspx http://blogs.msdn.com/b/oldnewthing/archive/2011/07/25/10189...
- WorldMaker 11y agoAlso the fact that for compatibility reasons the CMD shell doesn't do App Path-based lookups, but in some ways that is an implementation detail (and what "start.exe" and its PS equivalent are for), and something that only really impacts shell-using developers.
- rtpg 11y agoalways felt like the Windows mechanism of having at least one non-ambiguously global place to set environment variables to be super useful to deal with (instead of the ubuntu '/etc/environment/', except when it's '.profile', except when it's '.pam_environment', except when its '.bashrc')
- whoopdedo 11y agoBaseless argument. Windows also splits the environment between the HKLM and HKCU hives. It just gives you a handy window to edit both at once. .profile is a login script, not the recommended place for setting variables although historically it has been because /etc/environment and ~/.pam_environment are relatively recent additions to Linux. (Why didn't distros adopt the ~/.env though that other Unixes, like AIX, use?) But there Windows also has the profile login script and I don't know if it's possible to export environment variables from it but that serves the same purpose of ~/.profile. So all those things you say are bad about Linux exist on Windows.
- gpvos 11y agoI never heard of /etc/environment and ~/.pam_environment before, and thought /etc/profile was the place for variables for all users, with only .profile and .bashrc to check for user variables. Looks like Linux is going the Windows way by providing too many places to configure things.
- rtpg 11y agoI'm not against there being many different hooks in your average linux distro, but googling 'how to set environment variables in Ubuntu' gives you 20 different answers, with many conflicting statements between them.
- telotortium 11y agoHaving worked with AIX fairly recently, I was under the impression that ~/.env was merely a common value for the ENV environment variable, which is a shell script that plays the same role for Korn shell (and possibly POSIX sh) as ~/.bashrc does for Bash. This page seems to support that interpretation: http://www-01.ibm.com/support/knowledgecenter/ssw_aix_71/com.ibm.aix.osdevice/env_file.htm%23env_file?lang=en http://www-01.ibm.com/support/knowledgecenter/ssw_aix_71/com.... On the other hand, I think /etc/environment on Linux (not sure about AIX) and ~/.pam_environment are not shell scripts.
- galago 11y agoI dream that someday I can cut and paste from the command prompt. I mean, I'm really happy that Microsoft is actually making improvements to parts of windows that have been needlessly awkward for decades.
- lockyc 11y agoyou can now in Windows 10
- dan-silver 11y agoDetails of what's changed in the win 10 console https://blogs.windows.com/buildingapps/2014/10/07/console-improvements-in-the-windows-10-technical-preview/ https://blogs.windows.com/buildingapps/2014/10/07/console-im...
- phillco 11y agoInteresting that they default QuickEdit mode to on now. In Windows 2000 (supposedly), they had to roll a hotfix because some well-meaning engineer made the same change without thinking of backwards compatibility. [2] Kinda shows how times have changed. [1] "One of the top requested changes we’ve received over the years is to have quick-edit mode enabled by default. Tada!" [2] http://blogs.msdn.com/b/oldnewthing/archive/2007/09/13/4886108.aspx http://blogs.msdn.com/b/oldnewthing/archive/2007/09/13/48861...
- eurekin 11y agoI remember on a few occasions staring puzzled at some script at work, which was taking a lot more time to run, than normally. Like an hour instead of few minutes. I remember also, that coworkers had the same issue. One of them left work once, leaving a long process running. He came back the next day and it hadn't finish yet. He was ready to file a bug report somewhere, when we found out... If you click on the command prompt with the QuickEdit mode turned on, in a "wrong way", the underlying process will be frozen. It's because the input and output streams are blocked indefinitely, until you finish your selection and the content gets copied to the clipboard. So, why would you want to click on it? There is a common pattern people use for long running scripts: they push the window somewhere in the background, but leave a little space you can click on, so that you can view it very quickly. The "wrong way" of clicking is when you do click-drag instead of a point click. It goes automatically into the QuickEdit mode freezing everything underneath it.
- lancefisher 11y agoAnd next year when ASP.NET 5 ships, we'll finally be able to use environment variables for appSettings [1] instead of the hacked up mess that web.config is right now. [1] http://docs.asp.net/en/latest/fundamentals/configuration.html http://docs.asp.net/en/latest/fundamentals/configuration.htm...
- kristianp 11y agoThat might have provided the motivation to improve the environment variable editor.
- jsudhams 11y agoIsn't it bad? Given that only admin/power user can change environment variable, this will be a issue in shared hosting right?
- frik 11y agoHave you ever seen a shared web hoster that used Windows server edition? Shared hosting usually runs on LAMP. And server admins/devops won't have a problem. Applications will hopefully use variable with a prefix, e.g. App123Debug
- insulanian 11y ago> Applications will hopefully use variable with a prefix, e.g. App123Debug Hopefully...
- jsudhams 11y agoYes, all the time. Azure / EC2 all provide top class windows hosting. But for low cost shared I am stuck with arvixe and aspdiscount or so... But yeah I have only windows hosting over 10 years . Gives me everything PHP, python, .net , MySQL , mssql. I find Linux shared hosting too restricted. especially with sql server express edition...For me writing .net (actually vb.net) is way faster personally than even C# I use it all the time , I use c# only when some function is missing even then I use c# via library and still keep the vb.net. Though lately vb.net sample codes is very low but easy to convert from c#. Tried python like it but that 4 whitespace or whatever freaks me out. Currently on Go and Erlang learning path... but yeah IIS 8.0 excellent platform for low traffic websites
- netheril96 11y agoNow Mac OS X is the only major operating system without an easy way to modify environmental variables. Sure, you can edit your `.profile` or `.bashrc` or `.zhsrc`, but those settings do not carry over to your GUI applications, like the IDEs I am used to.
- __david__ 11y agoWhich is weird because it used to. But ~/.MacOSX/environment.plist (easily edited in the plist editor) got deprecated and isn't used any more. Edit: Don't know if you know this, but you can use "launchctl setenv key value" to set environment variables that get used by GUI programs. Unfortunately there are 2 huge caveats: 1) it's not persistent so you need to make something that load them at boot time, and 2) if you load them too late, they won't be part of the Dock or Finder process and you'll need to restart those processes to get your custom env vars in there. When you click something from the Dock, it inherits the environment from the Dock, so it's important to get your vars into the Dock itself. I've now grown used to running a script manually at boot time and then doing "killall Dock" so that when I launch Emacs or XCode I get the right PATH. If someone has a smoother solution, I'd love to hear it.
- deleted 11y ago[deleted]
- epistasis 11y agoApplications are spawned by launchd, which is why changing shell environments doesn't get propagated to GUI apps. Use: launchctl setenv MYVAR myval to change the launchd environment and those of the launched apps. These changes are lost after a reboot, unless you configure launchd via a plist file with these values. And there's a graphical plist editor for those that really like guis for these things. That said, OS X is fairly hostile to the use of environment variables as required settings for GUI apps. Personally, I can't really blame them...
- ethana 11y agoYou can't believe how many of the legacy stuff Windows still has. The folder sharing dialog is still clunky like it's 1998.
- jodrellblank 11y agohttp://www.online-tech-tips.com/wp-content/uploads/2007/09/windows-hidden-share.png http://www.online-tech-tips.com/wp-content/uploads/2007/09/w... became http://cloud.addictivetips.com/wp-content/uploads/2012/03/windows-8-share-folders.png http://cloud.addictivetips.com/wp-content/uploads/2012/03/wi... a few years ago. Although I think it's for the worse, it hasn't stayed the same since 1998.
- nogridbag 11y agoIt would be nice if Windows had something equivalent to Airdrop. Then again, it probably wouldn't help when sharing files been Windows and OS X.
- mcintyre1994 11y agoI don't have a windows laptop with bluetooth to test, but doesn't bluetooth work for this? I haven't used Airdrop though so I might be missing something. But for example I've used it to send from my mac to android tablet when the terrible osx/Android file manager program fails to work. Edit: I think I fat finger downvoted parent, sorry
- dlandis 11y agoI've wondered why they didn't fix this so many times over the years. Every time I saw that one inch wide, unresizable text input for the PATH or other variable, I got that feeling of exasperation you get when you know a company doesn't listen to its customers. It would have been the easiest thing in the world to do and yet it took over a decade to do it.
- alister 11y agoWhat's completely inexplicable is why it took 23 years to do this. Consider this: (1) It's self-contained piece of UI code. It's not like this change will permeate effects throughout the OS. (2) It's a few man days of work. Let's say that as a super-exaggerated-extreme estimate, it is still only a few months of work. (3) Nobody was dependent on the current behavior. (4) Everybody hated the current behavior. Programmers jumped through hoops like copying&pasting the strings into an editor, making a change, and pasting it back. (5) They had at least 23 years to fix it (since at least Windows 3.1). There are more plausible explanations about MH370 than there are about Microsoft's thinking here.
- eropple 11y ago> What's completely inexplicable is why it took 23 years to do this. I don't think it's inexplicable at all. "It wasn't considered to be an important enough change to be worth developer time by the people who owned that chunk of the codebase." Maybe it became important enough, or maybe somebody decided to make it their priority to push the change through, but random sharp edges show up in enterprise products, and persist, all the time.
- deleted 11y ago[deleted]
- sien 11y agoPerhaps it was because MS didn't want manual PATH alterations to be easy or they suspected too many people would have made their program only work if there was a manual alteration to it. The DOS prompt being terrible for 20 years might have similar justification. In 1995 MS would have many developers who would have just shifted their DOS apps to the command line if they could have gotten away with it. The OSX finder may have been made similar ideas in mind.
- DonSchuler 11y ago>> What's completely inexplicable is why it took 23 years to do this. That is an interesting statement. The reason why this little piece of work (similiar a resizable cmd window) hasn't been done before shows the fundamental differences between Linux and Windows in what the creators think it was made for. 99 % of the Windows users will never use the env var dialog. Microsoft gave the other 1 % (devs) Microsoft obviously a very low priority in the past. That has changed. While I like Windows 10 overall, I still wish it was not so chatty. I don't want to need to think about what kind of personal information my devices steal and how to protect myself. I don't like it from my Android phone and I don't like it from my laptop.
- 0xcde4c3db 11y agoI hope this means that somebody also fixes KB329308, which I'm pretty sure was still around in Windows 7 (unless it already got fixed in 8/8.1) [1]. It's pretty easy to get bitten by this when setting up Java build tools on Windows. [1] https://support.microsoft.com/en-us/kb/329308 https://support.microsoft.com/en-us/kb/329308
- userbinator 11y agoDoes the "Edit Text..." button still allow access to the old single-string version? If so, that would be good - nothing worse than making one thing easy to do, but making something else that used to be easy nearly impossible.
- douche 11y agoIf we're ragging on ancient Windows history, could Microsoft please make Notepad kinda usable? Here's two simple changes that would hugely reduce the incidence of me roaring at my machine when I remote into a server that doesn't have Notepad++ yet: 1.) Don't set the filter on the file open dialog as .txt, by default, just make it all files. 2.) Handle newlines properly, even if they are evil Mac or Linux style ones. For the love of Cthulhu, don't rewrite it as a Modern app, just fix a few of the things that have been irritating for twenty years.
- sneak 11y agohere's a nickel, kid.
- frik 11y agoBut don't slap a ribbon bar or modern UI on it - like what happened to Wordpad and Paint (Win7+).
- TazeTSchnitzel 11y agoThe ribbon bar was an improvement for Windows Explorer, Paint and WordPad. But Notepad has so few features that there'd probably be no benefit.
- ygra 11y agoThe ribbon was specifically designed for programs that have so many functions and features that the traditional menu+toolbar would be nigh-unusable (as evident in older Office versions where users often didn't even know that certain features existed). So I guess indeed, Notepad with probably ten different functions that could be exposed, can live just fine with a menu bar.
- keeperofdakeys 11y agoNot to mention that it takes ages to open a file that's even a few megabytes in size (as a programmer I wouldn't dare ask what's going on inside, for fear of nightmares). The irony is that wordpad both handles newlines properly, and can open large files. So it trumps notepad on almost everything. Of course, by the time you've gotten to that point, you've probably installed a better editor.
- pix64 11y agoNow if only you could change the Path without logging out and back in.
- Too 11y agoYou can. At least for cmd.exe you just have to open a new console, but no need to fully log out and in again.
- ygra 11y agoThis works for any application started by Explorer (which also means the task bar and start menu). Windows broadcasts a message that the environment has changed and Explorer listens and updates its environment accordingly.
- frik 11y agoIt took them only 25 years to improve the UI (since early days of WinNT 3.1). Unsexy parts of the OS are rarely touched, e.g. the Windows system font folder import dialog used to look like a Win16 file open dialog even in Win7. On the other hand, it was probably by design. Microsoft wanted to promote the Windows Registry and GUI of Win95/NT4 and made the command prompt (cmd.exe and other Unix/DOS alike parts) unpopular and not easy to use.
- touristtam 11y agoDoesn't matter; I use Rapid Environment Editor http://www.rapidee.com/en/about http://www.rapidee.com/en/about
- crawrey 11y agoI want to know why we are still using environment variables (and paths to a lesser extent), other than the fact that they are heavily ingrained. Are there OSs out there that address this solution in a less archaic way?
- a_bonobo 11y agoTempleOS has something like a set of environment variables for each task - if the user asks for a variable and it isn't found, then the parental task's variables are checked, followed by the next parental task's variables etc., all the way up to Adam, which would be like global environment variables. http://www.templeos.org/Wb/Doc/Mysteries.html http://www.templeos.org/Wb/Doc/Mysteries.html
- elchief 11y agoYou can use 'set' to view envars. Want to see your postgres envars? Type 'set pg' and it will show anything starting with 'pg'. You can use 'setx' to permanently set envars too. You don't need to logout to use them, just restart cmd or whatever program you use.
- noinsight 11y agoOr you can just use PowerShell, which allows you to manipulate all kinds of things in a filesystem-like manner (PSProviders): Get-ChildItem env: New-Item -Path "env:\myvar" -Value "MyValue" Amongst other things, it works for the registry and even Active Directory. Edit: for persistency you actually need to use [Environment]::SetEnvironmentVariable("TestVariable", "Test value.", "User")
- ygra 11y agoI answered an interesting SO question on that recently, which asked how to save and restore the environment in PowerShell. Turns out, the environment being in a PSDrive helps very much with that because you can treat the variables just like you treat files: # Save environment $savedState = Get-ChildItem Env: # Restore environment Remove-Item Env:* $savedState | ForEach-Object { Set-Content Env:$($_.Name) $_.Value }
- cryptos 11y agoI never thought Windows would bring innovation in this dimension! I hated the PATH dialog for so many years so that I stopped hoping for anything better. Maybe someday we will have a decent terminal window, too!
- zongitsrinzler 11y agoIt's nice that MS is picking up the slack. Pity that all sane developers have already moved to OSX or Linux.
- runholm 11y agoThat's not true at all. In the corporate world Windows is still the default because of many the tools used to make large organisations flow are available only on Windows. OSX and Linux is used a lot as well, but it's most common in small organisations and new "hipper" companies.
- cm2187 11y agoThe UI was bad, but the length limit is my biggest grief with the path environment variable. A lot of useless drivers and software feel that they need to have their own entry and if you have enough software installed in a box, very bad things will happen when you reach that limit, starting with the windows UI falling apart.
- snarfy 11y agoAnd each entry is still limited to MAX_PATH.
- NicoJuicy 11y agoI don't know why everyone says copy paste from/to an text-editor... I copied a path into my clipboard and wrote ;{past-shortcut} and click ok. And the path was added. In terms of developer UX, i now have to do 1 step more (click add button, paste the string, click ok, click ok). PS. It was rare that i actually had to change a path
- Asbostos 11y agoAren't environment variables kind of a bad thing in Windows? They're global so installing an application that twiddles with them could break another application. Isn't that what we had the registry for and now AppData? Path is a bit different because it's helpful being global so any command prompt can use it. Though the start menu search bar doesn't seem to so wouldn't it be better moved to a setting in the command prompt and Powershell applications themselves?