创建使用相对路径的快捷方式

打开当前文件夹下相对路径快捷方式

具体以360NetRepair3.exe为例(路劲:360断网急救箱\360NetRepair3.exe)

创建快捷方式(explorer.exe 360断网急救箱\360NetRepair3.exe)

explorer.exe后接空格 

文件夹后接反斜杠\,不是/


最后把起始位置删除一下



回答: 要建立相对路径快捷方式,可以使用以下步骤。首先,我们需要定义快捷方式的目标路径和工作目录。目标路径是我们要运行的程序或文件的路径,而工作目录是程序或文件所在的目录。然后,我们可以使用winshell库中的shortcut函数创建快捷方式对象,并设置其属性。最后,我们可以使用dump函数显示快捷方式的值。下面是一个示例代码: ```python import winshell from pathlib import Path # 定义目标路径和工作目录 target_path = "path/to/your/program.exe" working_directory = "path/to/working/directory" # 创建快捷方式对象 shortcut_path = str(Path(winshell.folder('CSIDL_PERSONAL')) / "py_work" / "shortcut.lnk") with winshell.shortcut(shortcut_path) as shortcut: shortcut.path = target_path shortcut.working_directory = working_directory # 显示快捷方式的值 shortcut = winshell.shortcut(shortcut_path) shortcut.dump() ``` 请注意,上述代码中的目标路径和工作目录需要根据实际情况进行替换。 #### 引用[.reference_title] - *1* *2* *3* [10 行代码,用 Python 创建一个 Windows 桌面快捷方式!](https://blog.csdn.net/m0_61655732/article/details/120764579)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值