cd Документы.lnk gives the error "The folder name is incorrectly set", and

Документы.lnk opens a folder in explorer.exe. I just need to go on the shortcut in the terminal, how to do it?

  • for this, symbolic links are intended and not labels mklink /D документы "C:\документы" - teran
  • And so lnk label is a binary file, you can read the description of the structure here -> msdn.microsoft.com/en-us/library/dd871305.aspx - teran
  • Those. I do not have such opportunity? - E. Kochkurov
  • I think no. Replace with a symbolic link, you can even call it документы.lnk , if you want :) - teran

1 answer 1

I do NOT wildly understand why it may even be necessary.

But the solution exists:

https://superuser.com/questions/806932/how-can-i-parse-a-lnk-shortcut-from-the-command-prompt-in-windows

Here is the code for the batch file, to go to the directory, from the parsed lnk file (the path to which comes in the form of a parameter):

 @echo off echo set WshShell = WScript.CreateObject("WScript.Shell")>Tmp.vbs echo set Lnk = WshShell.Createshortcut(WScript.Arguments(0))>>Tmp.vbs echo WScript.Echo Lnk.TargetPath>>Tmp.vbs for /f "delims=" %%d in ('cscript //nologo Tmp.vbs "%~1"') do del Tmp.vbs & cd /d "%%d" 
  • I will add. Moving to the directory with the CD command will succeed if the directory is on the CURRENT disk. - Daemon-5
  • It is a pity that there is no native solution. Thank you - E. Kochkurov