我正在尝试设置别名来访问我的方案解释器。我尝试了以下方法:
set-alias scheme '& "C:\Program Files (x86)\MIT-GNU Scheme\bin\mit-scheme.exe" --library "C:\Program Files (x86)\MIT-GNU Scheme\lib"'
调用scheme
时收到以下错误消息:
Cannot resolve alias 'scheme' because it refers to term '& "C:\Program Files (x86)\MIT-GNU Scheme\bin\mit-scheme.exe" -
-library "C:\Program Files (x86)\MIT-GNU Scheme\lib"', which is not recognized as a cmdlet, function, operable program,
or script file. Verify the term and try again.
At line:1 char:7
+ scheme <<<<
+ CategoryInfo : ObjectNotFound: (scheme:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : AliasNotResolvedException
另一方面,直接调用& "C:\Program Files (x86)\MIT-GNU Scheme\bin\mit-scheme.exe" --library "C:\Program Files (x86)\MIT-GNU Scheme\lib"
可以正常工作。
答案 0 :(得分:4)
别名功能适用于简单名称别名,不允许使用参数。你需要的是一个功能,例如:
function scheme {
& "C:\Program Files (x86)\MIT-GNU Scheme\bin\mit-scheme.exe" --library "C:\Program Files (x86)\MIT-GNU Scheme\lib"
}