需要获取Java中的开始菜单路径 [英] Need to get Start Menu Paths in Java

查看:200
本文介绍了需要获取Java中的开始菜单路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Java,我想要一些可以获取以下路径的代码:
1)当前用户
的开始菜单2)所有用户的开始菜单

Using java, I would like some code that could get me the paths for: 1) Start Menu for Current User 2) Start Menu for All User

对于WinXP和Win7,我都需要答案。因此,希望有一个通用的答案可以使我俩都接受。

I need the answer for both WinXP and Win7. So hopefully there is a general answer that can get me both.

推荐答案

好,我想出了一个解决方案,但也许有人有一个比较合格的。

Okay, I figured out a solution, but maybe someone else has a more eligant one.

我打算做类似 Runtime.getRuntime()。exec(command);的事情。并且该命令将是用于查询以下注册表项的 reg查询:

I plan on doing something like "Runtime.getRuntime().exec(command);" and the command will be a "reg query" to query the following registry keys:

当前用户可以由以下用户引用: HKEY_CURRENT_USER\Software\Microsoft\ Windows\CurrentVersion\Explorer\Shell文件夹\开始菜单

Current User can referenced by: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Start Menu

可以通过以下方式引用所有用户: HKEY_LOCAL_MACHINE\Software\ Microsoft\Windows\CurrentVersion\Explorer\Shell文件夹\公共开始菜单

All users can be referenced by: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Common Start Menu

对于Win7和WinXP,这些都是相同的。如果其他人知道更好的解决方案,我也会很乐意研究。

These are the same for both Win7 and WinXP. If anyone else knows of a better solution, I'll be happy to look at it too.

这篇关于需要获取Java中的开始菜单路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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