當前位置:首頁 » 文件管理 » fso創建文件夾

fso創建文件夾

發布時間: 2024-07-05 19:19:46

Ⅰ vbs鍒涘緩鏂囦歡澶

dimpathname,filename,fso,read,str,filepath
setfso=createobject("scripting.filesystemobject")
pathname="path.txt"
str="ShutdownScript emotecomputer.txt"
iffso.fileexists(pathname)=true鑼勬福then'鍏堟潵鍒ゆ柇瀹冩槸涓涓鏈夋晥鐨勮礬寰+鏂囦歡,濡傛灉鎴愮珛,浠ヤ笅鍧囨寜姝e父紼嬪簭鎵ц
read=fso.opentextfile(pathname).readall'璇誨彇鍏ㄦ枃
foreachiinsplit(read,vbcrlf)'閬嶅巻鍏ㄦ枃姣忚岀殑鍐呭
ifinstr(right(i,1),"")=0thenfilename=i&""&strelsefilename=i&str'鍦ㄦ墽琛屼笅闈浠g爜涔嬪墠鍏堣繘棰ゆ瘉鎮勮屾牸寮忓寲澶勭悊鏂囨湰
filepath=left(filename,instrrev(filename,""))'鍒嗙昏礬寰
iffso.folderexists(filepath)=falsethenfso.createfolderfilepath'濡傛灉璺寰勫瓨鍦ㄥ垯鍒涘緩鏂囦歡澶
iffso.fileexists(filename)=falsethenfso.createtextfile(filename).write"test"'濡傛灉鏂囦歡浣欏惖瀛樺湪鍒欏壋寤烘枃浠跺啓鍏test
next
endif

Ⅱ 鐢╒BS閫氳繃for寰鐜鎵歸噺鍒涘緩鏂囦歡澶瑰拰鏂囦歡

Sub locCreateResultFolder()
Dim fso
Dim i,vPath
Set fso = CreateObject("Scripting.FileSystemObject")
vPath = "C:\Program Files\personal\"
fso.CreateFolder "C:\Program Files\personal\"
fso.CreateFolder "C:\Program Files\personal\testFolder"
for i=0 to 100
If Not fso.folderexists(vPath&"testFolder\"&i) Then
fso.CreateFolder(vPath&"testFolder\"&i)
End If
next
End Sub
call locCreateResultFolder
'createfolder鏂規硶鍦ㄨ岃皚鍒涘緩鐩褰曟椂錛屼笂灞傜洰褰曞繀欏誨瓨鍦ㄣ
'鑰呰春渚嬪傚壋寤 c:\1\2錛屽傛灉c鐩樹笅娌℃湁鐩褰1錛岄偅棣栧甫媧句箞灝變細鍑洪敊錛堜笉鍒涘緩鐩褰2錛夈

Ⅲ VBS濡備綍閫氳繃FSO鍒涘緩鏃ユ湡鍛藉悕鐨勬枃浠跺す錛屽苟鍦ㄦ枃浠跺す閲屽壋寤烘椂闂村懡鍚嶇殑鏂囨。銆

Const ForReading = 1, ForWriting = 2, ForAppending = 8
AA = "D:\鏃﹀瓭"&FormatDateTime(Date, 1)
BB = AA & "\"& hour(time) & Minute(time) & Second(time)&".txt"
Set fso = CreateObject("妯℃竻紼縎cripting.FileSystemObject")
msgbox fso.FolderExists(AA)
IF fso.FolderExists(AA)=FALSE THEN
Set f = fso.CreateFolder(AA)
END IF
Set f = fso.OpenTextFile(BB, ForWriting, True)
f.Write "鍡錛屼綘濂斤紒"姝g噧
f.Close

熱點內容
我的世界國際服加模組的伺服器 發布:2025-01-26 18:25:22 瀏覽:940
怎麼讓微信加密碼 發布:2025-01-26 18:24:46 瀏覽:178
編譯時出現錯誤以下敘述正確的是 發布:2025-01-26 18:12:03 瀏覽:190
農村老年人的社保卡密碼是多少 發布:2025-01-26 18:11:53 瀏覽:227
路由器伺服器異常是什麼原因 發布:2025-01-26 18:06:23 瀏覽:450
編譯程序總框 發布:2025-01-26 17:52:29 瀏覽:87
編程叫碼農 發布:2025-01-26 17:45:45 瀏覽:786
bat刪除指定文件夾 發布:2025-01-26 17:41:58 瀏覽:651
哪些汽車品牌配置防爆胎 發布:2025-01-26 17:39:42 瀏覽:617
怎麼更改蘋果密碼怎麼辦 發布:2025-01-26 17:15:55 瀏覽:273