使用组合框和按钮从闪存驱动器打开文件 [英] Opening files from a flash drive using combobox and button

查看:63
本文介绍了使用组合框和按钮从闪存驱动器打开文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试打开我的闪存驱动器上的一些应用程序(.exe),使用多个ComboBox来选择不同类型的程序和一个按钮来启动所选程序。我的问题是闪存驱动器不会总是e:\。我需要我的程序从闪存驱动器当前目录中打开文件。我已经完成了批量实际操作... Visual Basic我遇到了麻烦。在批处理或cmd中,它就像这样简单。


start"" theprogramfolder\theprogram.exe


我试图使用


shell" theprogramfolder\theprogram.exe"


但显然最终会出现错误

加上我需要它与组合框一起使用所以我已经完成了

I''ve been trying to open some applications (.exe) that are on my flash drive using multiple ComboBox''s to select the different types of programs and a button to lauch the selected program. My issue is the flash drive wont always be e:\. I need my program to open the files from the flash drives current directory. I''ve done it in batch real easy...Visual Basic I''m having trouble. In batch or cmd its as easy as this

start "" "theprogramfolder\theprogram.exe"

I''ve tried to use

shell "theprogramfolder\theprogram.exe"

but obviously just end up with an error
plus I need it to be used with the combobox so ive done

展开 | 选择 | < span class =codeLinkonclick =WordWrap(this);> Wrap | 行号

推荐答案

我认为你正在寻找类似的东西:

I think you are looking for something like:

展开 | 选择 | Wrap | 行号


我试过了,它似乎没有work
I''ve tried that and it doesn''t seem to work




如果您担心找到exe所在的USB驱动器,那么您可以遍历系统上的所有可移动驱动器并检查是否您的文件存在于驱动器上。如果它存在,那么使用Process类来运行你的exe文件。


如果您的exe文件位于USB驱动器上的子文件夹中,那么您将需要提供完整路径而不需要像这样的驱动器号
Hi,
If your worried about finding the usb drive that the exe is on then you can loop through all the Removable drives on the system and check if your file exists on the drive. If it exists then use the Process class to run your exe file.

If your exe file is located in a subfolder on the usb drive then you will need to supply the full path without the drive letter like this
展开 | 选择 < span class =codeDivider> | Wrap | 行号


这篇关于使用组合框和按钮从闪存驱动器打开文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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