當前位置:編程學習大全網 - 編程軟體 - 求助編程牛人,壹斷簡單的代碼不會。

求助編程牛人,壹斷簡單的代碼不會。

這個很簡單,給妳壹個最簡單的實現吧。

把下面代碼保存成vbs文件,然後放入妳這個含有Data目錄的文件夾,直接雙擊就行了。

把代碼中的Data改成其他的,就是運行其他文件夾下的文件。

Dim?path

Dim?folder

folder?=?"data"

path=""

Set?ws?=?CreateObject("WScript.Shell")

path?=?Left(wscript.scriptfullname,InStrRev(wscript.scriptfullname,"\"))?

path?=?path?&?folder

test()

sub?event_onquit

WScript.quit?

quit

end?sub?

Function?test()

Set?fso?=?CreateObject("Scripting.FileSystemObject")

Set?folder?=?fso.GetFolder(path)

getFilesInFolder(folder)

End?Function?

Function?getFilesInFolder(folder)?

Dim?files

Dim?s

Dim?fileName

Set?files?=?folder.Files

For?Each?file?in?files

fileName=file.Name

ws.run?path?&?"\"?&?fileName

Next

End?Function

  • 上一篇:10款君威氣囊電腦板在哪
  • 下一篇:編程語言案例
  • copyright 2024編程學習大全網