繁体   English   中英

如何在Windows的node_modules .bin文件夹中建立到命令的有效符号链接?

[英]How do I make a working symlink to a command in my node_modules .bin folder on Windows?

我想从我的根目录运行lab ,而不必弄乱%bindir%.\\node_modules\\.bin\\lab.cmd 我希望能够使用$ lab进行测试,仅此而已。

这是我的尝试。 请记住,我已经为Powershell中的grep等设置了一些别名。

$ ll .\node_modules\.bin | grep lab
-a----         7/5/2017   2:57 PM            293 lab
-a----         7/5/2017   2:57 PM            170 lab.cmd

$ cmd /c mklink lab .\node_modules\.bin\lab\lab.cmd
symbolic link created for lab <<===>> .\node_modules\.bin\lab\lab.cmd

$ ll lab

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a---l         7/7/2017   9:04 AM              0 lab

$ lab
lab : The term 'lab' is not recognized as the name of a cmdlet, function, script file... 

$ ./lab
Program 'lab' failed to run: No application is associated with the specified file...

给别名lab.cmd命名没有任何作用。 在Windows上可以吗?

我真的认为这不是Windows真正建立的问题。 我确实认为您可以通过某种方式整理出符号链接,但实际上,这就是各种powershell配置文件的用途。 当某些事情不应该在系统范围内出现,但是您希望轻松快速地访问它时。

如果您只希望自己使用它,则可以将其放在$ profile中,如果您希望将它提供给任何用户,则可以运行powershell,因为可以将其放在C:\\ windows \\ System32 \\ WindowsPowerShell \\ v1中。 0 \\ Microsoft.PowerShell_profile.ps1

Windows中存在符号链接的功能,但它并不如* nix那样充实,无论好坏,这取决于位置,文件名以及可能会遇到各种问题的许多其他古怪的事物。 。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM