WSH/フォルダの存在チェックを行う・FolderExists
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
]
開始行:
#navi(../)
* フォルダの存在チェックを行う・FolderExists [#ce74ed08]
FileSystemObjectのFolderExistsメソッドを使用することによ...
以下にFolderExistsメソッドを使用したVBScriptサンプルコー...
#contents
#htmlinsertpcsp(win-top.html,win-sp.html)
* 関連記事 [#df97e17d]
-[[ファイルを行単位で読み込む方法・ReadLineメソッド>WSH/...
-[[ファイルを新規に作成しテキストを書き込むサンプルコード...
-[[既存ファイルをにテキストを追加書き込みするサンプルコー...
-[[ファイルの存在チェックを行う・FileExists>WSH/ファイル...
-[[ファイルの削除を行う方法・DeleteFile>WSH/ファイルの削...
-[[ファイルまたはフォルダーを別の場所にコピーする・Copy>W...
* フォルダ(ディレクトリ)の存在チェックを行うVBScriptサン...
以下に、ファイルの存在チェックを行うVBScriptサンプルコー...
** VBScriptサンプルコード [#hf5688ee]
#ref(folderexists.vbs)
Set fso = CreateObject("Scripting.FileSystemObject")
' Create Folder
fso.CreateFolder("hoge")
' FolderExists sample
If fso.FolderExists("hoge") Then
WScript.Echo "hoge folder exists."
Else
WScript.Echo "hoge folder not found."
End If
If fso.FolderExists("bar") Then
WScript.Echo "bar folder exists."
Else
WScript.Echo "bar folder not found."
End If
' Delete Folder
fso.DeleteFolder("hoge")
Set fso = Nothing
上記のVBScriptサンプルコードは以下のように動作します。~
+hogeフォルダを作成
+FileSystemObjectのFolderExistsメソッドを使いhogeフォルダ...
+同じくFileSystemObjectのFolderExistsメソッドを使い、bar...
+作成したhogeフォルダを削除する
** VBScriptサンプルコード実行結果 [#m278080c]
C:\wsh>cscript /nologo folderexists.vbs
hoge folder exists.
bar folder not found.
#htmlinsertpcsp(win-btm.html,win-sp.html)
終了行:
#navi(../)
* フォルダの存在チェックを行う・FolderExists [#ce74ed08]
FileSystemObjectのFolderExistsメソッドを使用することによ...
以下にFolderExistsメソッドを使用したVBScriptサンプルコー...
#contents
#htmlinsertpcsp(win-top.html,win-sp.html)
* 関連記事 [#df97e17d]
-[[ファイルを行単位で読み込む方法・ReadLineメソッド>WSH/...
-[[ファイルを新規に作成しテキストを書き込むサンプルコード...
-[[既存ファイルをにテキストを追加書き込みするサンプルコー...
-[[ファイルの存在チェックを行う・FileExists>WSH/ファイル...
-[[ファイルの削除を行う方法・DeleteFile>WSH/ファイルの削...
-[[ファイルまたはフォルダーを別の場所にコピーする・Copy>W...
* フォルダ(ディレクトリ)の存在チェックを行うVBScriptサン...
以下に、ファイルの存在チェックを行うVBScriptサンプルコー...
** VBScriptサンプルコード [#hf5688ee]
#ref(folderexists.vbs)
Set fso = CreateObject("Scripting.FileSystemObject")
' Create Folder
fso.CreateFolder("hoge")
' FolderExists sample
If fso.FolderExists("hoge") Then
WScript.Echo "hoge folder exists."
Else
WScript.Echo "hoge folder not found."
End If
If fso.FolderExists("bar") Then
WScript.Echo "bar folder exists."
Else
WScript.Echo "bar folder not found."
End If
' Delete Folder
fso.DeleteFolder("hoge")
Set fso = Nothing
上記のVBScriptサンプルコードは以下のように動作します。~
+hogeフォルダを作成
+FileSystemObjectのFolderExistsメソッドを使いhogeフォルダ...
+同じくFileSystemObjectのFolderExistsメソッドを使い、bar...
+作成したhogeフォルダを削除する
** VBScriptサンプルコード実行結果 [#m278080c]
C:\wsh>cscript /nologo folderexists.vbs
hoge folder exists.
bar folder not found.
#htmlinsertpcsp(win-btm.html,win-sp.html)
ページ名: