该术语在 cmder / powershell 中未被识别为 cmdlet 函数脚本文件或可运行程序...
The term is not recognized as cmdlet function script file or operable program ... in cmder / powershell
我使用 cmder,并在用户配置文件中为 powershell 创建了一些别名。ps1 在 cmder/config/user-profile.ps1.
文件看起来像这样
# Use this file to run your own startup commands
New-Alias subl "C:\Program Files\Sublime Text 3\sublime_text.exe"
New-Alias mysql "D:\wamp\bin\mysql\mysql5.7.11\bin\mysql.exe"
New-Alias o Invoke-Item
New-Alias c Clear-Host
New-Alias hosts "subl $env:windir\System32\drivers\etc\hosts"
New-Alias .. "cd .."
New-Alias www "cd d:\wamp\www"
除“..”、'www' 和 'hosts' 外,所有别名都可以正常使用。例如,当我写 'hosts' 时,它会给我一个类似
的错误
The term "subl C:\Windows\System32\drivers\etc\hosts" is not recognized as cmdlet function script file or operable program
At line:1 char:1
+ hosts
+ ~~~~~
+ CategoryInfo : ObjectNotFound: (subl C:\Windows...ivers\etc\hosts:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
但是,当我在 cmder 'subl C:\Windows\System32\drivers\etc\hosts' 中编写时,它起作用了。有什么问题?
在 PowerShell 中,别名是到 命令 的映射 - 而不仅仅是任何类型的表达式。
如果你想hosts
在Sublime中打开hosts文件,定义一个函数代替:
function hosts { subl $env:windir\System32\drivers\etc\hosts }
同..
和www
function .. { cd .. }
function www { cd d:\wamp\www }
我使用 cmder,并在用户配置文件中为 powershell 创建了一些别名。ps1 在 cmder/config/user-profile.ps1.
文件看起来像这样
# Use this file to run your own startup commands
New-Alias subl "C:\Program Files\Sublime Text 3\sublime_text.exe"
New-Alias mysql "D:\wamp\bin\mysql\mysql5.7.11\bin\mysql.exe"
New-Alias o Invoke-Item
New-Alias c Clear-Host
New-Alias hosts "subl $env:windir\System32\drivers\etc\hosts"
New-Alias .. "cd .."
New-Alias www "cd d:\wamp\www"
除“..”、'www' 和 'hosts' 外,所有别名都可以正常使用。例如,当我写 'hosts' 时,它会给我一个类似
的错误The term "subl C:\Windows\System32\drivers\etc\hosts" is not recognized as cmdlet function script file or operable program
At line:1 char:1
+ hosts
+ ~~~~~
+ CategoryInfo : ObjectNotFound: (subl C:\Windows...ivers\etc\hosts:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
但是,当我在 cmder 'subl C:\Windows\System32\drivers\etc\hosts' 中编写时,它起作用了。有什么问题?
在 PowerShell 中,别名是到 命令 的映射 - 而不仅仅是任何类型的表达式。
如果你想hosts
在Sublime中打开hosts文件,定义一个函数代替:
function hosts { subl $env:windir\System32\drivers\etc\hosts }
同..
和www
function .. { cd .. }
function www { cd d:\wamp\www }