如果该文件夹不存在,如何在VB中创建一个文件夹?
问题描述:
我为自己编写了一个小的下载应用程序,以便我可以轻松地从服务器上获取一组文件,然后将它们全部安装到具有全新安装的Windows的新PC上,而无需实际上网。不幸的是,我在创建要放入文件夹的文件夹时遇到了问题,不确定如何处理。
I wrote myself a little downloading application so that I could easily grab a set of files from my server and put them all onto a new pc with a clean install of Windows, without actually going on the net. Unfortunately I'm having problems creating the folder I want to put them in and am unsure how to go about it.
我希望程序将应用程序下载到程序文件-在这里有任何名称-
I want my program to download the apps to program files\any name here\
所以基本上我需要一个函数来检查文件夹是否存在以及是否存在
So basically I need a function that checks if a folder exists, and if it doesn't it creates it.
答
If(Not System.IO.Directory.Exists(YourPath)) Then
System.IO.Directory.CreateDirectory(YourPath)
End If