Windows 批量列印

2021-09-13 14:55:47 字數 1805 閱讀 4174

2010-05-21 13:28:27

|  分類:技術|

舉報|字型大小訂閱

最近搞畢業設計評語,有n多的**要列印,乙個個列印太麻煩,就寫了vbs指令碼,能列印當前目錄下所有

doc檔案,並遞迴列印其子目錄,還能對不需要列印的文件進行過濾。

用記事本新建乙個txt檔案,拷入如下**後,另存時選擇型別為「所有檔案」,檔名為printdoc.vbs,或者其它名字,當副檔名必須為vbs。**如下

filterstr=inputbox("請輸入不要列印的檔案,用逗號分隔。如2,1表示檔名包含2或者1的不列印,輸入*表示列印所有:")

filtered=false

printme=true

if filterstr<>"*" and filterstr<>""  then

filtered=true

filterlist=split(filterstr,",")

end if

if filterstr<>"" then

set wshshell = wscript.createobject("wscript.shell") 

printsub(wshshell.currentdirectory)

msgbox "完工啦!"

end if

sub printsub(byval curdc)

set fso =createobject("scripting.filesystemobject")

wd.visible=false

set fd = fso.getfolder(curdc)

set fn = fd.files

for each f1 in fn

if filtered then

printme=true

for each fl in filterlist

if instr(lcase(left(f1.name,len(f1.name)-3)),fl)<>0 then             

printme=false

end if

next

end if

if ucase(right(f1.name, 3)) = "doc" and printme then

set doc=wd.documents.open(fd.path & "\" & f1.name)

doc.printout

doc.close

'wd.documents.close

set doc=nothing

end if

next

wd.visible=true

wd.quit

set subfd=fd.subfolders

for each folder in subfd

printsub(folder.path)

next

set subfd=nothing

set fn=nothing

set fd=nothing

set wd = nothing

set fso = nothing

end sub 

直接雙擊vbs程式執行,彈出一對話方塊,如果要列印所有檔案,則輸入「*」號並確定,如果有不想列印的檔案,輸入關鍵字並用逗號分隔,比如「遞交,2.1「表示不列印所有檔名中包含」遞交「兩字或者」2.1」兩字的檔案。逗號輸入用英文方式。程式能列印所有子目錄及子子目錄,希望大家用的愉快!

posted @

2014-04-17 11:01

心靈捕手 閱讀(

...)  

編輯收藏

列印及批量列印

開發十年,就只剩下這套架構體系了!總述 引入列印的js檔案,把需要列印的內容window.print 列印出來即可。注 print 可設定引數,如不需要列印的內容。列印 一 單頁列印 引入js和新增列印js 頁面新增列印按鈕 二 批量列印 思路 獲取到每個選中的核取方塊的值 如下圖 用get同步請求...

windows元件列印

1.在form窗體拖入列印控制項,命名設定如下 pagesetupdialog name pagesetupdialog1document設為printdocument控制項的例項 printdialog name printdialog2document設為printdocument控制項的例項 ...

windows批量建立使用者

一 建立使用者的命令列語法 建立使用者 net user使用者名稱密碼 add 如 net user test 123 add 提公升許可權 net localgroup 使用者許可權組使用者名稱 add 如 net localgroup administrator test add 刪除使用者 n...