當前位置:ag真人国际官网-ag旗舰厅官方网站 » 文件管理 » fso創建文件夾

fso創建文件夾-ag真人国际官网

發布時間: 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

熱點內容
sqlserver如何切換主備伺服器 發布:2024-07-17 16:23:02 瀏覽:298
mc18伺服器ip 發布:2024-07-17 16:23:02 瀏覽:378
仙境傳說手游腳本 發布:2024-07-17 16:09:24 瀏覽:690
matlab命令窗口和新建腳本 發布:2024-07-17 15:51:26 瀏覽:374
建ftp文件夾 發布:2024-07-17 15:51:26 瀏覽:954
魔獸撿物腳本 發布:2024-07-17 15:27:56 瀏覽:129
開發ip伺服器 發布:2024-07-17 15:24:42 瀏覽:387
安卓系統視頻製作哪個好用 發布:2024-07-17 15:10:47 瀏覽:210
androidapk結構 發布:2024-07-17 15:10:43 瀏覽:945
c語言指針的例子 發布:2024-07-17 15:08:01 瀏覽:768
网站地图