【问题标题】:Auto run a jar file from usb drive从 USB 驱动器自动运行 jar 文件
【发布时间】:2011-10-22 22:04:25
【问题描述】:

我的 USB 驱动器中有一个可运行的 jar 文件。当 USB 驱动器插入系统时,我需要自动启动该 jar。我使用的是 Windows 7。我使用 autorun.inf 来启动 jar 文件。但它不起作用。请有任何建议。

autorun.inf

[Autorun]
Open=myjar.jar
Action=Start portable apps

【问题讨论】:

  • 将 USB 驱动器配置为在插入时自动运行是一种不好的做法。将您的计算机设置为 允许 随机 USB 驱动器在插入时自动运行代码是 even worse

标签: jar usb autoplay


【解决方案1】:

查看下方更新

最简单的方法是编写一个批处理文件(或命令文件)来自动运行。 包含以下内容:

runjar.bat

 java -jar myjar.jar

并在您的 autorun.inf 中执行以下操作:

[Autorun]
open=runjar.bat
action=start portable apps

更新

AAAH 问题是 Windows 7 已经删除了对 autorun.inf 的支持。见Autorun.inf Does Not Work In Windows 7 Anymore

【讨论】:

  • 感谢您的回复。但它没有用。它只是显示自动播放窗口以选择选项。
  • 嗯.. 我也发现了。但这也不适用于 Windows XP。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2021-12-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-01-31
  • 1970-01-01
相关资源
最近更新 更多