Using Windows shortcut with 'cmd /c start' not the same as from console

5

I'm using this method to launch Anaconda Prompt 32-bit version "open a regular command prompt, figure out where miniconda got installed, cd to the miniconda\Scripts directory and type "activate". Rsignell I'd like to be able to activate this from Cortana/Start Menu, because I'm using both 32 and 64-bit versions.

Following this workaround I added a shortcut:

cmd /c start "C:\path\to\Miniconda3\Scripts\activate"

with the name "Anaconda Prompt (32)". This icon has the right-click contextual Pin to Start option and Cortana can find this 32-bit shortcut.

However, the console that's launched is not an active conda environment: C:\WINDOWS\system32 > and should show up as (conda) C:\WINDOWS\system32 >. The same line used in a console will activate conda. Any suggestions to fix this solution?

xtian

Posted 2018-07-01T15:57:34.550

Reputation: 782

Answers

6

The console that's launched is not an active conda environment

You are using the start command incorrectly and it is not executing C:\path\to\Miniconda3\Scripts\activate.

The first parameter for start is the title bar text.

Try using:

cmd /c start "" "C:\path\to\Miniconda3\Scripts\activate"

Usage:

Syntax
      START "title" [/D path] [options] "command" [parameters]

Key:
   title       Text for the CMD window title bar (required.)
   path        Starting directory.
   command     The command, batch file or executable program to run.
   parameters  The parameters passed to the command.

...

Always include a TITLE this can be a simple string like "My Script" or just a pair of empty quotes "" According to the Microsoft documentation, the title is optional, but depending on the other options chosen you can have problems if it is omitted.

Source Start - Start a program - Windows CMD - SS64.com


Further Reading

DavidPostill

Posted 2018-07-01T15:57:34.550

Reputation: 118 938

2Wow! Great answer. That fixed it, but why does it work in the console? – xtian – 2018-07-01T16:29:32.257

@xtian Because from the console the sequence of commands you type don't have anything to do with start. – DavidPostill – 2018-07-01T18:07:57.817

1@DavidPostill Do tell - why does cmd /c start "C:\some\path" not have anything to do with start? – user253751 – 2018-07-02T01:43:25.127

@user20574 Ah. I misunderstood. I don't know why it works in the console, other than what it says in the last part of the answer. – DavidPostill – 2018-07-02T04:03:53.013