MobaXterm windows PATH variable prepends system32 directory - terminal

So launching CMD in MobaXterm you have the option to user Windows Path variable. However, rather than using the same %PATH%, MobaXterm prepends the following directories into %PATH%.
C:\Users\${USER_ID}\AppData\Local\Temp\Mxt82\bin;C:\WINDOWS;C:\WINDOWS\system32;
I wonder why it does this? This gives us inconsistent behavior as if we launched cmd directly.

Related

What is the difference between the PATH listed by 'env' in git-bash and the PATH in Windows 10's control panel?

My goal is to write a shell script that will ensure that a bunch of Windows 10 computers with Python freshly installed on them can run the 'python' command from a git-bash command line in Windows Terminal by having the script check the PATH environment variable and modify it if necessary.
More specifically, I want my script to check if the following three paths are part of each computer's PATH, and if they aren't already a part of it, edit the PATH so that it permanently contains them.
C:\Program Files\Python311
C:\Program Files\Python311\Scripts
C:\Users\ <localUser>\AppData\Roaming\Python\Python311\Scripts
What threw me off is that I noticed that the PATH variable that I get from the 'env' command on the git-bash command line is different from the PATH variable that I can see in Windows 10's control panel. I tried adding a junk path to PATH from the command line by typing
export PATH=/c/someNonexistentPath in git bash but it didn't change the PATH that I could see in the Windows 10 control panel. Moreover, I couldn't even see if it changed the PATH I get from running env on the command line because for some reason after you run any export command git-bash gets amnesia and refuses to recognize the env command until you start a new session of git-bash.
Shouldn't there only be one PATH on a computer? If the two seemingly different PATHs that I have mentioned are not supposed to be the same, what is the difference between them, and how can I accomplish my goal of writing the script so that it does what I need it to do?
Please let me know if I need to include any more system-specific info. Thanks in advance for your help.

Setting default path with custom variable in windows 10pro

I have been trying to get windows to recognize shortcuts for developer tools. Things like adb for C:\Users\myusername\Andriod\platform-tools\adb.exe. I have tried using CMD and Powershell but they both don't add the PATH I tried the GUI and it doesn't show up.
I've tried setx path "%PATH%;C:\path\to\C:\Users\myusername\Andriod\platform-tools\adb.exe" in powershell and cmd then restarted powershell or cmd
input the variable adb but it pulls a command not recognized error.
Did you try the following?
Adding the path "C:\Users\myusername\Andriod\platform-tools" to your system/user PATH variable? You can do this by start-> environment variable -> environment variable and under system or user, edit the PATH variable and add the above link. Once you do this, restart CMD for it to work.
Add the executable in one of the already existing locations that are in the PATH variable. (Although this is one method, I would not suggest this). Again, if the executable has any dependencies, it must be in a place where the exe itself can access.

Windows PATH variable is different if whether running CMD as admin or not

I just installed scala but I can't call it from the command line. So I dutifully checked my path through the environmental variables of the control panel and saw the scala folder present. If I type scala from cmd within that folder, it works fine.
So I tried echo %PATH% from windows cmd to see any problem. If running a normal command window, I get almost the same path except it's missing the scala path item. If I run the command line (Admin), then the echoed path matches the environment variables version. Under this admin setting, scala works fine.
There is no user path variable defined, it's only a system variable.
I've never seen this before. Why is there a difference between admin path and non-admin path? And how do I access the scala path item from the non-admin command line?
Thanks!
I just had the same problem, it was caused by the environment variables not being refreshed. A reboot would have solved it, however there is a way to refresh the environment variables without a reboot.
Open cmd prompt window
Input set PATH=C
close and restart cmd prompt window
input echo %PATH% to check
This worked for me in Windows 10.

External commands not available in gvim on windows

When starting a gvim session on windows 7, it appears that globally available commands like autopep8 or pylint cannot be executed. I.e. the command :!pylint opens up a console windows saying 'pylint' is not recognized as an internal or external command.
However, I can execute these commands from cmd.exe by just typing the respective names.
This is because I have added the path C:\Program Files (x86)\Python 3.5\Scripts; to the System Path environment variable. For some reason this is not picked up by the shell behind gvim.
The weird thing is that typing :echo $PATH shows a list or folders which includes C:\Program Files (x86)\Python 3.5\Scripts;.
I should also note that this problem does not occur when starting normal vim in a terminal like cmd.exe or git bash.
Any hints on what might be going wrong?

Commands Visibility at Command Prompty Not Using System32

Let's say I have a foo.exe file that I want to use it from windows command prompt. I will go to the folder which contains foo.exe and run it. Now, if I want global access for foo.exe from anywhere in the command prompt I will put foo.exe in System32 folder.
This process makes System32 a dump ground. I was wondering if there are any other ways of globally accessing the .exe or bat files without having to dump all of them in System32 folder.
Change your PATH environment variable. i.e. "set path=%path%;[newdir]"
where [newdir] is the new directory you want searched when you run commands.
The PATH Environment Variable
You can either do this programatically (StackOverFlow) or follow these instructions
How to set the path in Windows 2000 / Windows XP, another one.

Resources