Win7下如何获取虚拟机文件夹?
我正在编写一个名为 XP-More 的工具,它应该有助于管理 Windows 7 虚拟机。该工具启动后要做的第一件事就是找到 VM 文件夹。但是,事实证明该文件夹未列为 Windows 特殊文件夹。我使用了一种解决方法,但它不可靠。理想情况下,
Environment.GetFolderPath(Environment.SpecialFolder.VMFolder)
或者这样就可以完成这项工作,但 VMFolder 是我的想象的虚构。有没有真正的方法来获取该文件夹?
I'm writing a tool called XP-More, which should help manage Windows 7 Virtual Machines. The first thing the tool has to do when launched is find the VM folder. However, turns out that folder is not listed as a Windows Special Folder. I use a workaround, but it's unreliable. Ideally,
Environment.GetFolderPath(Environment.SpecialFolder.VMFolder)
or so would have done the job, but VMFolder is a fiction of my imagination. Is there any real way to get that folder?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我找到了这个。您可以获取默认文件夹,也可以搜索“myvirtualmachines”环境变量。
I found this. You can either get the default folder, or search for the 'myvirtualmachines' environment variable.
@m0sa - 您的解决方案适用于 Microsoft Virtual PC,但 Windows 7 附带了一个名为 Windows Virtual PC 的变体,它似乎略有不同。例如,在我的 Windows 7 上,既没有 myvirtualmachines 环境变量,也没有任何其他环境变量指向实际文件夹。
(很抱歉写这个作为答案。我知道这很糟糕,但目前我无法添加评论)
@m0sa - your solution works for Microsoft Virtual PC, but Windows 7 comes with a variant called Windows Virtual PC, which seems to be slightly different. On my Windows 7, for instance, there's neither myvirtualmachines environment variable nor any other one pointing to the actual folder.
(sorry for writing this as an answer. I know it sucks, but I can't add comments at this point)