0

Running on Windows Server 2012.

I've installed Anaconda on my machines, it automatically adds the relevant paths to PATH variable:

C:\Users\user1\tools\Anaconda3;C:\Users\user1\tools\Anaconda3\Scripts;

From within cmd, it won't allow me to use anaconda to execute the batch file. I must use anaconda.bat.

This is the same with all batch files, I've tested it with many. Any idea why and if so, how to fix this?

lit
  • 14,456
  • 10
  • 65
  • 119
notAChance
  • 1,360
  • 4
  • 15
  • 47
  • Because you've messed up the `PATHEXT` environment variable [How to run batch script without using *.bat extension](https://stackoverflow.com/q/13320578/995714), [Why do I have to type .exe after all commands in windows 10?](https://superuser.com/q/1079605/241386), [What would cause an EXE extension to be mandatory at the command line and how can it be resolved in the current shell?](https://superuser.com/q/973830/241386), [Server 2008 won't run executables from CMD prompt without .exe extension](https://serverfault.com/q/245751/343888) – phuclv Jun 12 '18 at 13:56

1 Answers1

0

Your asking a command line to execute a file. Computers are stupid. You'd still have to tell it to activate the .bat file. Its not like linux that will run the program. What you could do. Is make a small batch file.

Like:

Start C:\Windows\MY_ANACONDA_DONT_WANT_NONE\anaconda.bat

Then name it something like anaconda.bat And place it in your PATH. (by PATH, I mean the one your CMD links to like "C:\Windows\System32 folder on your computer.")

Then you should just be able to punch in anaconda and it will open it up.


Scott Chambers
  • 581
  • 6
  • 22
  • On my Windows 7 machine I have perl installed and in `PATH`. there are two files in the `bin` named `pkg-config`. One with no extension, and another with the `.bat` extension. If I remove the one with no extension from the file and leave the `.bat` file, then enter `pkg-config` on command line - it calls it. Perhaps it's a 2012 thing? – notAChance Jun 12 '18 at 10:31
  • I honestly threw my 2 cents in. I thought i could help. It might just be a 2012 thing. In all honesty in order for you to call something without the file. In linux you Chmod it, and then you should be able to call it after adding it to the bash. Im not sure if there is something similar in windows. What i described was a basic solution. – Scott Chambers Jun 12 '18 at 11:37
  • wrong, in Windows simply give the file name opens it. You don't need `start` and actually the behavior will be different with `start` – phuclv Jun 12 '18 at 14:19