我需要有关DOS命令的FolderBrowserDialog的帮助 [英] I need help with FolderBrowserDialog w/DOS Commands
本文介绍了我需要有关DOS命令的FolderBrowserDialog的帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我遇到问题的代码。打开FolderBrowserDialog并选择一个文件夹的代码效果很好。但是,我不知道如何把它放入dos命令,如下所示。
任何帮助将不胜感激。
here is my code for what i am having trouble with. the code to open the FolderBrowserDialog and select a folder works great. however, i am not sure how to put that into a dos command as indicated below.
Any help will be appreciated.
Private Sub btnDirectory_Click(sender As Object, e As EventArgs) Handles btnDirectory.Click
Dim objFolderDlg As System.Windows.Forms.FolderBrowserDialog
objFolderDlg = New System.Windows.Forms.FolderBrowserDialog
objFolderDlg.SelectedPath = "C:\Test"
If objFolderDlg.ShowDialog() = DialogResult.OK Then
'this part still does not work, unable to execute all the dos commands.
Shell("cmd /c CD{objFolderDlg.SelectedPath} dir /B >C:\Users\%USERNAME%\list\Directory_List.txt", vbHide)
MessageBox.Show(objFolderDlg.SelectedPath)
End If
End Sub
推荐答案
没有DOS命令这样的东西。请参阅: http://msdn.microsoft .com / zh-CN / library / system.diagnostics.process.start%28v = vs.110%29.aspx [ ^ ]。
也许,这就是你所需要的。
-SA
There is no such thing as "DOS command". Please see: http://msdn.microsoft.com/en-us/library/system.diagnostics.process.start%28v=vs.110%29.aspx[^].
Probably, this is all you need.
—SA
你不必使用shell命令。 .NET Framework具有名称空间System.IO,其中包含所有类以获取有关文件,文件夹等的信息。
从这里开始:
http://msdn.microsoft.com/library/System.IO%28v=vs。 110%29.aspx [ ^ ]
这将帮助您获取指定路径的目录和文件列表:
http://msdn.microsoft.com/library/system.io.directory% 28v = vs.110%29.aspx [ ^ ]
这将帮助您将信息保存到文件:
< a href =http://msdn.microsoft.com/library/system.io.streamwriter%28v=vs.110%29.aspx> http://msdn.microsoft.com/libr ary / system.io.streamwriter%28v = vs.110%29.aspx [ ^ ]
最后,要获取用户个人资料目录:
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)
希望它可以帮到你:)
You don't have to use shell commands. .NET Framework has namespace System.IO which contains all classes to get informations about files, folders etc.
Start here:
http://msdn.microsoft.com/library/System.IO%28v=vs.110%29.aspx[^]
This will help you to get list of dirs and files for specified path:
http://msdn.microsoft.com/library/system.io.directory%28v=vs.110%29.aspx[^]
This will help you to save informations to file:
http://msdn.microsoft.com/library/system.io.streamwriter%28v=vs.110%29.aspx[^]
And finally, to get user profile directory:
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)
Hope it helps you :)
谢谢所有的信息。我将详细介绍它们,看看我能做些什么来解决这个问题。
Thanks for all of the info. I will go through them all and see what i can do to solve this problem.
这篇关于我需要有关DOS命令的FolderBrowserDialog的帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文