如果该文件夹不存在,如何在VB中创建一个文件夹? [英] How do I create a folder in VB if it doesn't exist?

查看:321
本文介绍了如果该文件夹不存在,如何在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

这篇关于如果该文件夹不存在,如何在VB中创建一个文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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