gpt4 book ai didi

windows - 自动运行.inf : how to get drive letter?

转载 作者:可可西里 更新时间:2023-11-01 09:22:33 26 4
gpt4 key购买 nike

我已经通过 autorun.inf 将此条目添加到 USB 内存棒的上下文菜单中:

[AutoRun]
shell\pageant=Activate SSH Key
shell\pageant\command=PuTTY\pageant.exe PuTTY\davids.ppk

PuTTY\pageant.exePuTTY\davids.ppk 都是 U 盘上的文件,应该从那里获取。

当我从 stick 的根部在 shell 中运行它时,它按预期工作。但是从菜单启动它会尝试从 C:\Windows\system32\PuTTY\davids.ppk 加载 key (用 Process Monitor 检查)。

尝试使用一个简单的 cmd 脚本导致了这个输出:

    C:\Windows\system32>cd PuTTY    Das System kann den angegebenen Pfad nicht finden.    C:\Windows\system32>pageant.exe davids.ppk    Der Befehl "pageant.exe" ist entweder falsch geschrieben oder    konnte nicht gefunden werden.

有没有办法让它正常工作?我想它应该能够传递驱动器号或让资源管理器使用棒作为工作目录,但我不知道如何。由于我想随时随地使用 Stick,因此我宁愿避免对本地驱动器盘符进行硬编码。

最佳答案

我认为最简单的解决方案是创建一个批处理文件来为您执行此操作。像这样名为 activatekey.cmd 的东西:

REM switch to the directory containing this script
for %%a in (%0) do cd /D %%~da%%~pa

cd PuTTY
pageant.exe davids.ppk

将文件 activatekey.cmd 放入您的 U 盘,并将 autorun.inf 更改为:

[AutoRun]
shell\pageant=Activate SSH Key
shell\pageant\command=activatekey.cmd

关于windows - 自动运行.inf : how to get drive letter?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/823737/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com