我正在制作一个需要上下文菜单中的参数的程序(单击一个文件并使用文件名作为参数调用我的程序)。
我正在尝试向 ...\shell\myThing\command 添加一个注册表项。我想要的是以下内容:
C:\Program Files (x86)\Feliratozo\Feliratozo.exe %1
Run Code Online (Sandbox Code Playgroud)
我想使用 %ProgramFiles(x86)% 环境变量,因为我在某处读到它也适用于 x86 和 x64 Windows。(在 x86 上更改为“正常”程序文件。)当我尝试设置时出现问题:
%ProgramFiles(x86)%\Feliratozo\Feliratozo.exe %1
Run Code Online (Sandbox Code Playgroud)
这样,当我尝试使用上述上下文菜单项时,会出现以下错误:
Windows cannot access the specified device, path, or file. You may not have the appropriate permissions to access the item.
Run Code Online (Sandbox Code Playgroud)
权限问题似乎不正确,因为在使用绝对路径时它可以工作。
我现在能做什么?
我创建了一个 powershell 脚本,我想在每次注销/重启/关闭时运行它。
对于触发器,我设置了一个自定义事件:日志:系统,来源:Winlogon,事件 ID:7002。我在互联网上的某个地方找到了上述事件 ID - 它代表注销(AFAIK)。
问题是它只有在我去按注销时才有效。当我想关闭或重新启动 PC 时,它不会。
它甚至应该工作吗?如果没有,我在哪里可以找到其他事件 ID?我什至如何寻找它们?(我的意思是他们叫什么名字?)