是否可以在以管理员身份运行的 Windows 中创建相对路径的快捷方式? [英] Is it possible to make a shortcut to a relative path in Windows that runs as admin?

查看:57
本文介绍了是否可以在以管理员身份运行的 Windows 中创建相对路径的快捷方式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要创建具有相对路径的快捷方式,请将目标设置为以下内容.

To create a shortcut with a relative path, set the target to the following.

%windir%\system32\cmd.exe /c start your_relpath\app.exe [your_args]

让程序以管理员身份运行也很简单.

It is also straightforward to make the program run as administrator.

Properties > Advanced > Run as administrator

但是把两者放在一起是行不通的.当 cmd.exe 以管理员身份启动时,它会丢失当前工作目录并转到 %windir%\system32.相对路径从那里开始,这不是故意的.

But putting the two together doesn't work. When cmd.exe is started as admin, it loses the current working directory and goes to %windir%\system32. The relative path starts there which is not intended.

有什么方法可以制作一个两者相对的快捷方式并以管理员身份运行?

Is there any way to make a shortcut that is both relative and run as admin?

推荐答案

我没有找到简单的方法,但这很好.我担心具有绝对路径的快捷方式会在计算机之间中断.我没有意识到 Windows 会自动更正它们.这似乎足够了,尽管相对路径会更优雅.

I didn't find an easy way but that's fine. I was concerned that shortcuts with absolute paths would break between computers. I didn't realize that Windows corrected them automatically. This seems sufficient, though relative paths would have been more elegant.

虽然快捷方式在创建时指向特定文件或文件夹,但如果将目标移动到另一个位置,它们可能会中断.Microsoft Windows 具有用于在移动快捷方式时修复快捷方式的标准算法.基于 Windows 9x 的 Windows 版本使用简单的搜索算法来修复损坏的快捷方式. [1]在基于 Windows NT 的操作系统和 NTFS 文件系统上,目标对象的唯一标识符存储在快捷方式文件中,Windows 可以使用分布式链接跟踪服务来跟踪快捷方式的目标,以便在出现以下情况时可以静默更新快捷方式目标移动到另一个硬盘.[4]

Although shortcuts, when created, point to specific files or folders, they may break if the target is moved to another location. Microsoft Windows has standard algorithms for fixing up shortcuts when they are moved. Windows 9x-based versions of Windows use a simple search algorithm to fix broken shortcuts.[1] On Windows NT-based operating systems and the NTFS file system, the target object's unique identifier is stored in the shortcut file and Windows can use the Distributed Link Tracking service for tracking the targets of shortcuts, so that the shortcut may be silently updated if the target moves to another hard drive.[4]

http://en.wikipedia.org/wiki/File_shortcut#Microsoft_Windows

这篇关于是否可以在以管理员身份运行的 Windows 中创建相对路径的快捷方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆