ContinuumIO / anaconda-issues

Anaconda issue tracking
646 stars 220 forks source link

Maximum command length issue of *.lnk on windows #7789

Open metorm opened 6 years ago

metorm commented 6 years ago

I am using the anaconda installation installed by VS 2017. The default installation path is C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64

Here comes the problem: the path is too long for windows to parse using a shortcut. Take the default Anaconda Prompt shortcut for example. Since the maximum allowed command length is 260, the command is cut like this:

"C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\pythonw.exe" "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\cwp.py" "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64" %windir%\system32\cmd.exe "/K" "C

Which obviously cannot be correctly parsed.

I think there shall be some way to fix this.

BTW, anyone please post me the full command?

mingwandroid commented 6 years ago

The path is not too long. Shortcuts have a very long limit (32k characters I think). The problem here is that the Windows dialog that shows and allows you to edit shortcuts is limited to 260 odd characters. This means editing it in this dialog breaks it.

You can drop a .lnk file into any hex editor to see the full contents.

On Fri, Dec 15, 2017 at 1:02 PM, Wesley Ranger notifications@github.com wrote:

I am using the anaconda installation installed by VS 2017. The default installation path is C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64

Here comes the problem: the path is too long for windows to parse using a shortcut. Take the default Anaconda Prompt shortcut for example. Since the maximum allowed command length is 260, the command is cut like this:

"C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\pythonw.exe" "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\cwp.py" "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64" %windir%\system32\cmd.exe "/K" "C

Which obviously cannot be correctly parsed.

I think there shall be some way to fix this.

BTW, anyone please post me the full command?

β€” You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ContinuumIO/anaconda-issues/issues/7789, or mute the thread https://github.com/notifications/unsubscribe-auth/AA_pdN-BEYHpmvYZgi6B7YxuN7B3ky8Vks5tAm3mgaJpZM4RDc5L .

metorm commented 6 years ago

Well, I first noticed this because the shortcut failed to execute. I think I didn't edit the shortcut before.

mingwandroid commented 6 years ago

The failure to execute is not caused by it being long I'm afraid. You need to dig into what happens when you run it from cmd.exe, replacing pythonw.exe with python.exe (so yes getting the full value is important. I do not know which version of Anaconda comes with VS2017 so I cannot advise on that beyond 'use a hex editor').

metorm commented 6 years ago

It is a good idea to use python.exe to replace pythonw.exe, but I am afraid that I won't have to chance to dig any deeper ... Before your first reply is posted, I already uninstalled the anaconda comes with VS 2017 and installed a new one in the default location C:\PragramData\. It is working as expected.

Thank you anyway.

nvrcek commented 6 years ago

Can someone please paste me original lnk file to Anaconda prompt (After installation/update of VS 2017)? I tried to edit it in dialog and now it is broken. I would not like to completely reinstall everything. I would try to recreate this original lnk although it does not work anyway. It worked before VS 2017 update but now I cannot run prompt and cannot launch apps from Anaconda Navigator. Anaconda updates also do not work properly. Thank you

quevedin commented 6 years ago

@metorm , I had the same problem. Delete the C at the end. Should work. "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\pythonw.exe" "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\cwp.py" "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64" %windir%\system32\cmd.exe "/K" "

metorm commented 6 years ago

😏😏😏

发θ‡ͺζˆ‘ηš„ε°η±³ζ‰‹ζœΊ 在 Lucas Fernandez Seivane notifications@github.com,2018εΉ΄1月19ζ—₯ δΈ‹εˆ7:19ε†™ι“οΌš

@metormhttps://github.com/metorm , I had the same problem. Delete the C at the end. Should work. "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\pythonw.exe" "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\cwp.py" "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64" %windir%\system32\cmd.exe "/K" "

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/ContinuumIO/anaconda-issues/issues/7789#issuecomment-358938337, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ALhd-OGzWWsv3cWvcyceqAO0k9Z7Z6U2ks5tMHpPgaJpZM4RDc5L.

TkYu commented 6 years ago

we can do this:

  1. find current Anaconda location (eg: C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64)
  2. mklink /h /j %USERPROFILE%\Anaconda3 "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64"
  3. locate your lnk file (eg: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Anaconda3 (64-bit))
  4. change these lnk's "Start in" with "%HOMEPATH%"
  5. change lnk's target with these: