exe2bat的指令碼 複製代碼 代碼如下: fp=wscript.arguments(0) fn=right(fp,len(fp)-instrrev(fp,"")) with createobject("adodb.stream") .type=1:.open:.loadfromfile fp:str=.read:sl=lenb(str) end with sll=sl mod 65536:slh=sl65536 with
為瞭解決這類問題,我使用Visual Basic Scripting設計了一個指令碼,可以自動達到這個目標。在本指令碼中,自動壓縮所有檔案。為了避免將指令碼自己也壓縮排去,使用了一些判斷。 複製代碼 代碼如下: call main() Sub main() Dim fs '檔案系統。 Dim f 'folder Dim fc 'files Dim s 'string Dim ws 'SHELL。 Dim subfs Dim fi '建立SHELL。 Set ws = CreateObject("
複製代碼 代碼如下: On Error Resume Next Dim objFSO,sourcepath,targetpath Function GetZipFile(path) Dim file,folder,sfolder,subfolder,files If Not objFSO.FolderExists(path) Then Msgbox "目標檔案夾不存在!" Else objFSO.CreateFolder targetpath &
Because of its length, only the code for the function itself is shown on this page. The demo script that shows how to use this function is available as a separate download. 複製代碼 代碼如下: Function ReadRegValue( myComputer, myRegPath, myRegValue ) ' This
This script demonstrates how to save information to a xml file with the use of MSXML. The example xml file is used for the photo album on the site. 複製代碼 代碼如下: '***************************************************************** '** Script:
Name 屬性設定或返回指定的檔案或檔案夾的名稱。可讀寫。object.Name [= newname] 參數object必選項。應為 File 或 Folder 對象的名稱。newname可選項。如果提供此參數,則指定的 object 名稱更新為 newname。說明以下代碼舉例說明如何使用 Name 屬性:Function ShowFileAccessInfo(filespec) Dim fso, f, s Set fso =
ParentFolder 屬性返回指定檔案或檔案夾的父資料夾。唯讀。object.ParentFolder object 應為 File 或 Folder 對象的名稱。說明以下代碼舉例說明如何使用 ParentFolder 屬性:Function ShowFileAccessInfo(filespec) Dim fso, f, s Set fso = CreateObject("Scripting.FileSystemObject") Set f =
ShortName 屬性返回按照早期 8.3 檔案命名規範轉換的短檔案名稱。object.ShortName object 應為 File 或 Folder 對象的名稱。說明以下代碼舉例說明如何使用 ShortName 屬性:Function ShowShortName(filespec) Dim fso, f, s Set fso = CreateObject("Scripting.FileSystemObject") Set f =
複製代碼 代碼如下: '向指定的檔案寫字串,第三個參數指定是否刪除原來的內容 Function Z_WriteFile(sFileName, sText, bAppend) Dim fs, fso, iomode if bAppend = True Then iomode = 8 'ForAppending else iomode = 2 'ForWriting end if set fs = CreateObject("Scripting.FileSystemObject") set fso