の作成方法を教えてくださいフォルダVBっていることを確認してくださいがありますか?

StackOverflow https://stackoverflow.com/questions/85996

  •  01-07-2019
  •  | 
  •  

質問

に書いた自分で少しダウンロード申請るように、簡単にグラブの設定ファイルからのサーバーに入ってます)として新しいpcクリーンのインストールWindowsかずにいます。残念ながらないのにフォルダるわけにはいきませんびamに迷ったらどのように行います。

の気持ちを抱いて欲しいと思いプログラムをダウンロードアプリケー program files\any name here\

のではないでしょうかいが必要な機能するかどうかをチェックしますフォルダが存在し、やっていることを確認してくださいまを生成します。

役に立ちましたか?

解決

If(Not System.IO.Directory.Exists(YourPath)) Then
    System.IO.Directory.CreateDirectory(YourPath)
End If

他のヒント

下のシステム。IOあるクラスというディレクトリです。次の

If Not Directory.Exists(path) Then
    Directory.CreateDirectory(path)
End If

対するコレクションは、ディレクトリがあります。

からの問いんです。純この作VBScriptはVB6.

Dim objFSO, strFolder
strFolder = "C:\Temp"
Set objFSO = CreateObject("Scripting.FileSystemObject")
If Not objFSO.FolderExists(strFolder) Then
   objFSO.CreateFolder(strFolder)
End If

試しに システム。IO.DirectoryInfo クラスです。

サンプルからMSDN:

Imports System
Imports System.IO

Public Class Test
    Public Shared Sub Main()
        ' Specify the directories you want to manipulate.
        Dim di As DirectoryInfo = New DirectoryInfo("c:\MyDir")
        Try
            ' Determine whether the directory exists.
            If di.Exists Then
                ' Indicate that it already exists.
                Console.WriteLine("That path exists already.")
                Return
            End If

            ' Try to create the directory.
            di.Create()
            Console.WriteLine("The directory was created successfully.")

            ' Delete the directory.
            di.Delete()
            Console.WriteLine("The directory was deleted successfully.")

        Catch e As Exception
            Console.WriteLine("The process failed: {0}", e.ToString())
        End Try
    End Sub
End Class

VB.NET?システム。IO.ディレクトリです。が存在する(string path)

してみてください: Directory.Exists(TheFolderName)Directory.CreateDirectory(TheFolderName)

していただく場合があり: Imports System.IO)

ディレクトリです。CreateDirectory()すべきです。http://msdn.microsoft.com/en-us/library/system.io.directory.createdirectory(VS.71).aspx

また、Vista、ほとんどできない書き込C:直接場合を除きとして実行する管理者ですと、しみやすく心のこもったバイパスとのdirしたいサブdir C:(僕は好き?--そんなど多くの人々だけでダンプナメッC

い役立っています。

輸入システム。IO)

if Not Directory.Exists(Path) then
  Directory.CreateDirectory(Path)
end if
If Not Directory.Exists(somePath) then
    Directory.CreateDirectory(somePath)
End If

実際に試したほうがよいでしょうファイルを用いてシステムオブジェクトFSO.多くの方法に属するこのオブジェクトにチェックインされる場合フォルダが存在しなどの新しいフォルダの中に別のフォルダを作

っこう、という量そのものを作るダイアログボックスできるユーザー名のフォルダとフォルダ場所をつかえば直通なので大変助かります。

乾杯

だいこ

        Dim sPath As String = "Folder path here"
    If (My.Computer.FileSystem.DirectoryExists(sPath) = False) Then
        My.Computer.FileSystem.CreateDirectory(sPath + "/<Folder name>")
    Else
        'Something else happens, because the folder exists
    End If

I宣言されたフォルダのpath文字列として(sPathい方をすれば利用で複数回変更することができます簡単にでも変更することができますのプログラムそのものです。

希望です!

-nfell2009

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top