在部署计算机上获取正确的USB路径 [英] Getting the correct Path to the USB on the deployment machine
问题描述
希望有人可以在这里为我提供帮助...基本上,我正在编写一个部署程序,并使用正在执行的程序的路径来访问包含我在部署过程中传递的数据的文件夹.
我在用电话
Hopefully somebody can help me out here ... basically I am writing a deployment program and am using the path of the program that is executing in order to access the Folders containing data that I am passing as part of the deployment.
I was using the line
myPath = Path.GetDirectoryName(Application.ExecutablePath);
但是由于失败,我现在正在使用这条线
but as that was failing I am now using this line
myPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().CodeBase);
在我的(Vista)台式机和笔记本电脑上,这两种功能都可以正常工作给我执行程序的确切路径.但是,当我通过即将作为E:驱动器的USB在(WinXP)笔记本电脑上运行安装程序时,mySetup并未设置为
Both of these work just fine on my (Vista) Desktop & give me the exact path of the executing program. However, when I run the Setup on my (WinXP) laptop via a USB which is coming up as the E: drive, mySetup is NOT set to
E:\KAELC\mySetup
我会期望的,但是它设置为(类似)
as I would expect, but it is set to (something like)
C:\Documents And Settings\Gary\Local Settings\Apps\2.0\GPACJD60.Z71\H0J8N8V7.3VK\kael..tion_b7e3cbeea3dd9a25_0001.000_ce512e4defa9e
Can somebody please explain how I get around this ?!?
推荐答案
请检查XP机器是否具有带驱动器名称的映射网络共享.如果是,请将其删除,然后重试.
为了更好的理解,请参考以下链接
http://www.petri.co.il/control-usb- drive-letter-assignment-in-windows.htm [ ^ ]
如果您认为此帖子正是您在寻找答案的确切内容,请将其标记为答案....:)
Please, check whether the XP machine has any mapping network share with a drive name. If yes remove it and try it again.
For better understanding please refer to the following link
http://www.petri.co.il/control-usb-drive-letter-assignment-in-windows.htm[^]
If you feel this post was the exact thing which you were looking for your answer please mark it as answer.... :)
Senguptaamlan,谢谢您的建议,但没有,在笔记本电脑上没有映射,它只是一个基本的新安装,它会找到USB作为驱动器E:每次,它只是程序中被转移"的该路径!!!
更新...我在儿子的Windows 7笔记本电脑上遇到了同样的问题:-(
Hi senguptaamlan, thanks for the suggestion, but no, there is no mapping on the laptop, it''s just a basic, new installation & it finds the USB as drive E: every time, it''s just this path inside the program that is being "diverted" !!!
UPDATE ... I get the same problem on my son''s Windows 7 laptop :-(
这篇关于在部署计算机上获取正确的USB路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!