尝试在 dos shell 中为 exe 文件的路径分配别名
我想为我安装的 Firefox 设置一个别名,以便我可以轻松启动网页,问题是我不希望脚本依赖于系统。 也就是说,我希望它能够在 Linux 发行版上运行,其中启动 firefox 的命令已经映射到“firefox”,并且可以通过 bash 轻松地以这种方式运行,但在我的 Windows 机器上,我似乎无法将其分配给相同的变量。
我看到我可以通过 set 命令将其设置为“%firefox%”,但这并不是我想要的。
我相信在 Windows 环境中创建别名是可能的,因为我使用的 svn 版本是自动安装的,并且能够将自己分配给“svn”。任何人都知道他们能够让他们的别名工作,或者类似的命令别名的方式涉及什么?
I want to set an alias to my installation of firefox so I can easily start a web page, the problem is that I dont want the script to be system dependent.
Namely I want it to be able to run on a linux distribution where the command to start firefox is already mapped to 'firefox' and can easily be run that way through bash, but on my windows machine I cant seem to get it to assign to the same variable.
I saw that I could set it to '%firefox%' via the set command but that's not quite what I want.
I believe creating aliases is possible on a windows environment because the version of svn that I use auto-installed and was able to assign itself to 'svn'. Anyone know what was involved in them being able to get their alias working, or a similar way to alias a command?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您将 Firefox 路径包含在 %PATH% 环境变量中,则可以使用“firefox”启动 FF。在 Windows 下,您应该编辑系统范围的设置(请参阅此链接)。
AFAIK,没有什么类似于 DOS/Windows 下的别名(除了你提到的 %firefox% 方式)。您谈到的“svn”命令很可能是同一件事,“svn.exe”及其路径包含在%PATH%中。
这有点限制,因为您只能使用原始文件名来启动程序,但您可以通过在启动程序的程序路径中创建一个批处理文件来解决此问题,例如包含“firefox %1”的 FF.BAT ”。
或者,您可以将批处理文件放置在 %PATH% 中已有的路径中,例如 Windows 目录。这样,您就不必修改%PATH%。
If you include your Firefox path in the %PATH% environment variable, you can start FF with "firefox". Under Windows, you should edit the system-wide settings (see this link).
AFAIK, there is nothing similar to aliases under DOS/Windows (except the %firefox% way you mentioned, too). The 'svn' command you talked about most likely is the same thing, a 'svn.exe' and its path included to %PATH%.
This is a bit restrictive, as you can only use the original filename to launch a program, but you can work around this by creating a batch file in the program's path that launches the program, f.e. a FF.BAT that contains "firefox %1".
Alternatively, you can place a batch file in a path that already is in %PATH%, f.e. the Windows directory. That way, you don't have to modify %PATH%.