Windows and terminal is good, but how to create god damn it softlink quickly? #14340

Closed
opened 2026-01-31 04:07:37 +00:00 by claunia · 7 comments
Owner

Originally created by @lucasjinreal on GitHub (Jun 25, 2021).

I just want something like:ln -s....

Originally created by @lucasjinreal on GitHub (Jun 25, 2021). I just want something like:`ln -s`....
claunia added the Issue-QuestionNeeds-TriageNeeds-Tag-Fix labels 2026-01-31 04:07:37 +00:00
Author
Owner

@zadjii commented on GitHub (Jun 25, 2021):

What shell are you using? PowerShell? Command Prompt? Git bash? WSL?

@zadjii commented on GitHub (Jun 25, 2021): What shell are you using? PowerShell? Command Prompt? Git bash? WSL?
Author
Owner

@lucasjinreal commented on GitHub (Jun 26, 2021):

powershell I think

@lucasjinreal commented on GitHub (Jun 26, 2021): powershell I think
Author
Owner

@lhecker commented on GitHub (Jun 26, 2021):

@jinfagang This project is only concerned with drawing text on your screen (the "terminal"). What the text means that you enter is up to the so called "shell", or in this case PowerShell.

First of all: Windows didn't have symlinks (or "softlinks") for most of it's life and they were added "relatively" recently. There is another type apart from soft- and hardlinks under Windows and NTFS: Junctions. Junctions are basically the same as softlinks, but work across drives and even for network shares. They only work for absolute paths to directories though.

Anyways, softlinks can be created like so:

  • Using cmd.exe: mklink [/d] <link> <target> - mklink creates softlinks only for files by default. You must specify the optional /d parameter if you want to create a softlink for a directory instead. You'll have to get mklink from somewhere as it's not shipped with regular Windows
  • Using PowerShell: New-Item -ItemType SymbolicLink -Name <link> -Target <target>. Once you ran it, you can find it in your PowerShell history later again, by writing New- and pressing F8 repeatedly. That way you won't have to remember the correct parameters yourself. (F8 searches the PowerShell history by default.)

Additionally you'll find many articles in the internet which can help you with that. In order to have a simple ln -s command for PowerShell you can create a function for this yourself that emulates ln's behavior and calls New-Item for you.

I'll close this issue as it's not related to this project. Please reopen this issue if you believe that this was wrong of me. I can also try to help you while this issue is closed. 🙂

@lhecker commented on GitHub (Jun 26, 2021): @jinfagang This project is only concerned with drawing text on your screen (the "terminal"). What the text means that you enter is up to the so called "shell", or in this case PowerShell. First of all: Windows didn't have symlinks (or "softlinks") for most of it's life and they were added "relatively" recently. There is another type apart from soft- and hardlinks under Windows and NTFS: Junctions. Junctions are basically the same as softlinks, but work across drives and even for network shares. They only work for absolute paths to directories though. Anyways, softlinks can be created like so: * [Using cmd.exe](https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/mklink): `mklink [/d] <link> <target>` - mklink creates softlinks only for files by default. You must specify the optional `/d` parameter if you want to create a softlink for a **d**irectory instead. You'll have to get mklink from somewhere as it's not shipped with regular Windows * [Using PowerShell](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/new-item?view=powershell-7.1#example-7--create-a-symbolic-link-to-a-file-or-folder): `New-Item -ItemType SymbolicLink -Name <link> -Target <target>`. Once you ran it, you can find it in your PowerShell history later again, by writing `New-` and pressing F8 repeatedly. That way you won't have to remember the correct parameters yourself. (F8 searches the PowerShell history by default.) Additionally you'll find many articles in the internet which can help you with that. In order to have a simple `ln -s` command for PowerShell you can create a function for this yourself that emulates ln's behavior and calls `New-Item` for you. I'll close this issue as it's not related to this project. Please reopen this issue if you believe that this was wrong of me. I can also try to help you while this issue is closed. 🙂
Author
Owner

@vefatica commented on GitHub (Jun 26, 2021):

Isn't MKLINK internal to CMD.EXE?

@vefatica commented on GitHub (Jun 26, 2021): Isn't MKLINK internal to CMD.EXE?
Author
Owner

@lhecker commented on GitHub (Jun 26, 2021):

@vefatica Oh right I forgot that mklink also exists as a builtin in cmd.exe!
(It also exists as a separate tool outside of cmd.exe.)

@lhecker commented on GitHub (Jun 26, 2021): @vefatica Oh right I forgot that `mklink` also exists as a builtin in cmd.exe! (It also exists as a separate tool outside of cmd.exe.)
Author
Owner

@lucasjinreal commented on GitHub (Jun 27, 2021):

@lhecker this is tricky. mklink I think is tolerantable. but such New-Item is soooooo looooong. why not just make it shorter? But mklink not avaliable in powershell, I use powershell everyday, in 2021 who will using cmd.exe?

@lucasjinreal commented on GitHub (Jun 27, 2021): @lhecker this is tricky. mklink I think is tolerantable. but such New-Item is soooooo looooong. why not just make it shorter? But mklink not avaliable in powershell, I use powershell everyday, in 2021 who will using cmd.exe?
Author
Owner

@DHowett commented on GitHub (Jun 28, 2021):

We do not control how powershell names their commands.

@DHowett commented on GitHub (Jun 28, 2021): We do not control how powershell names their commands.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#14340