Tag Info

Hot answers tagged

29

I'm afraid its not quite that simple. environment variables are not limited by scope, as you suggest, but you are right, the lifetime of the value in the variable is different when comparing the verbs. Set modifies the current shell's (window) environment values, and the change is available immediately, but it is temporary. the change will not affect other ...


7

When defining variables in PowerShell, single quotes (') mean you want the literal version of the string. Use double-quotes (") if you want to allow variable expansion: PS C:\> $a = "hello" PS C:\> $a hello PS C:\> $b = "$a world!" PS C:\> $b hello world! More info: Single Quotes vs. Double Quotes in PowerShell: What's the Difference? ...


5

Yes, it's normal - one is the User-specific PATH (HKCU\Environment\PATH in the registry) and the other the System PATH (HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\PATH). Note that the User PATH environment variable is not present by default when a new account is created, and is either created manually if required or by a user-installed ...


2

Each process has a list of strings which it maintains as its environment. When you add, modify or delete items from this list, the runtime library has to update the corresponding array. Because there is no standard requirement for maintaining that in sorted form, the runtime uses what the developers decided was the quickest way to update the list. ...


2

set /p UserInputPath = Enter chosen PC: ^ This space is included in the name of the variable So you end with a variable named %UserInputPath % Better use set /p "UserInputPath=Enter Chosen PC: " ping "%UserInputPath%.store.domain.company.com"


2

To change from within Windows, try the following: Pin PowerShell to the taskbar. Right click the PowerShell icon on the taskbar. Right click 'Windows PowerShell' and select 'Properties'. Within the 'Properties' window, go to the 'Shortcut' tab and change the 'Start in:' field to your desired starting directory. (Example: C:\Users\username\Desktop). Click ...


2

Just realised as I'd just installed python that there would be a system restore point from that, so I rolled back to that point. Job done After the restore, the two paths do appear to be different. When I run echo %PATH% in the command prompt The result is the system path concatenated with the user path.


2

After a bit of trial and error, I discovered that these environment variables are the additional ones reported by SET on my Windows 8.1 system: ALLUSERSPROFILE APPDATA CommonProgramFiles CommonProgramFiles(x86) CommonProgramW6432 COMPUTERNAME HOMEDRIVE HOMEPATH LOCALAPPDATA LOGONSERVER ProgramData ProgramFiles ProgramFiles(x86) ProgramW6432 PROMPT PUBLIC ...


1

You can always query the registry values directly: for /f "skip=2 tokens=2*" %a in ('reg query HKCU\Environment /v PATH') do @echo %b for /f "skip=2 tokens=2*" %a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v PATH') do @echo %b


1

As you have already found out, %PATH% in the init.bat does include the user path. The problem however isn't entirely cmders fault. It has something to do with DOS, or the batch file. For example with PATH as C:\Program Files (x86)\MySQL\MySQL Fabric 1.5.4 & MySQL Utilities 1.5.4 1.5\ The line @set PATH=%OTHER_PATHS%;%PATH% gets replaced to @set ...


1

Introduction If I understand you correctly, you want to add any directories "$X/node_modules/.bin" where $X is the $PWD or any of its ancestors. The script at the end of this post should give the behaviour you want. You need to source it in every session where you want it. If you name the file augment_path.sh, then adding this line to your .bashrc should ...


1

You don't actually need the user name to put something in their home structure. Simply starting ~/ will direct it to their home, so ~/Library/ will go to the current user's [Boot Drive]/Users/[User Name]/Library/. If you need to install for all users, use /Library/ instead. I guess it's the equivalent of Windows' %appdata%/ If you really need the ...


1

If you want to use environment variables inside a registry key without having to use cmd to expand them, you will need to use a REG_EXPAND_SZ registry key type, not the default REG_SZ of the "(Default)" registry value. But the registry editor does not allow you to change the type of the "(Default)" registry value, so, you will need to use something like ...


1

Following script works, at least for me on Win7. @echo off set /p name="Enter name:" ping %name%.google.com We first ask user to enter name, then store it in name variable, and pass it to ping (see %name%) adding google.com (just as example!).


1

According to SS64.com (Autoexec.bat section), those variables may be boot-time variables, that are "not available to 32 bit gui programs". Since Windows XP, boot-time environment variables should be set with the registry in: HKEY_CURRENT_USER\Environment (USER environment variables) or: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session ...


1

No - one is the system path, and one is yours, which is added to the system path. Open a command-window and type path to see the result. If you arbitrarily delete from the system path things that happen to append in the user path, you will likely interfere with processes which you do not own. Just because you are the "only" user on the system, for ...



Only top voted, non community-wiki answers of a minimum length are eligible