如何打开本地文件夹上的文件..? [英] How to open files on local folder..?

查看:132
本文介绍了如何打开本地文件夹上的文件..?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨.是否可以在csharp中调用.vbs或.chm文件.例如,如果我单击Button,它必须从HardDisk打开匹配的文件名和扩展名的文件.如果我给出完整的链接,但它所在的驱动器可能有所不同,我可以轻松打开它. 'View'文件夹位于我的Project目录中,并且在我的解决方案资源管理器中也显示为Root文件夹,以便它可以正常运行Help.chm放置在View文件夹中....现在我可以复制整个项目文件夹,包括该数学文件夹和运行没有问题
这就是我的意思

Hi. is it Possible to invoke .vbs or .chm files in csharp. For example If I click on Button It must Open the file of matching filename and extention from HardDisk..I can easily open if i give the full link but the drive where it is located may vary ....so I want to take ''View'' folder which is inside my Project directory and also shows at my solution explorer as Root folder so that it works Help.chm placed in View folder....now now i can copy the whole project folder including that math folder and run without problem
Here what I meant

<br />
System.Diagnostics.Process.Start(@"C:\Documents and Settings\Munni\My Documents\UCMAS\abacus_Buttons_updated\Abacus.Main\View\Help\Abacus Park 2008.chm");<br />


如果项目文件夹不在我的文档"中,则即使存在视图和帮助文件夹也无法使用
我想做的是,而不是从C:\ ...中搜索,我只想从view文件夹中搜索该文件,以便可以将abacus_Buttons_updated文件夹放在我喜欢的任何位置,并且仍然可以正常运行...


If the project folder is not in ''my documents'' it wont work even if view and help folder are present
What i wanted to do is Instead of searching from C:\... I want to search that file only from view folder so that I can take abacus_Buttons_updated folder anywhere i like and still run with no problem...

推荐答案

您可以使用可执行文件中的相对路径.例如,使用"\ Abacus.Main \ View \ Help \ Abacus Park 2008.chm"代替@"C:\ Documents and Settings \ Munni \ My Documents \ UCMAS \ abacus_Buttons_updated \ Abacus.Main \ View \ Help \ Abacus Park 2008 .chm,如果您的exe在abacus_Buttons_updated中.
You can use the relative path from your executible. For example use "\Abacus.Main\View\Help\Abacus Park 2008.chm" instead of @"C:\Documents and Settings\Munni\My Documents\UCMAS\abacus_Buttons_updated\Abacus.Main\View\Help\Abacus Park 2008.chm if your exe is in abacus_Buttons_updated.


我认为问题可能出在命令行中的空格.您需要引用enitre命令.将代码更改为此:

I think the problem might be the spaces in your command line. You need to quote the enitre command. Change your code to this:

System.Diagnostics.Process.Start(@"\"C:\Documents and Settings\Munni\My Documents\UCMAS\abacus_Buttons_updated\Abacus.Main\View\Help\Abacus Park 2008.chm\"");


我认为您没有收到我的问题.我想做的是,而不是从C:\ ...中搜索,我只想从view文件夹中搜索该文件,这样我就可以将abacus_Buttons_updated文件夹放在我喜欢的任何位置,并且仍然可以正常运行...
I think You didnt get my question. What i wanted to do is Instead of searching from C:\... I want to search that file only from view folder so that I can take abacus_Buttons_updated folder anywhere i like and still run with no problem...


这篇关于如何打开本地文件夹上的文件..?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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