我可以使用 Windows 中的快捷方式为应用程序设置环境变量吗? [英] Can I set an environment variable for an application using a shortcut in Windows?
本文介绍了我可以使用 Windows 中的快捷方式为应用程序设置环境变量吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我觉得我应该能够将目录添加到 PATH基于应用程序生命周期的环境变量,但我不知道如何执行此操作.是否可以将参数添加到 Windows 快捷方式,将目录附加到 PATH 的当前值以供被链接的应用程序使用?
I have a feeling I should be able add a directory to the PATH environment variable on an application-lifetime basis, but I can't find out how to do this. Is it possible to add a parameter to a Windows shortcut that appends a directory to the current value of PATH for use by the application being linked?
推荐答案
让快捷方式执行一个批处理文件(.cmd),即
Let the shortcut execute a batch file (.cmd), that
- 设置环境变量
- 执行应用
- 您使用START";要执行应用程序,这将在另一个进程中启动应用程序,但它会复制环境.您无需等待应用完成.
- 现在您可以退出批处理文件了.
应该是这样的:
@echo off
set path=%path%;C:My Folder
start "Window Title" "Path to my exe"
这篇关于我可以使用 Windows 中的快捷方式为应用程序设置环境变量吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文