由于項(xiàng)目需要在windwos系統(tǒng)中添加多臺(tái)虛擬打印機(jī)(能夠正常打印出紙),查找了一下系統(tǒng)函數(shù)。
使用 rundll32 printui.dll,PrintUIEntry,在CMD中運(yùn)行,在彈出框中得到以下提示。
用法: rundll32 printui.dll,PrintUIEntry [options] [@commandfile]
/a[file] 二進(jìn)制文件名 /b[name] 基本打印機(jī)名 /c[name] 如果操作在遠(yuǎn)程機(jī)器上,unc 機(jī)器名 /dl 刪除本地打印機(jī) /dn 刪除網(wǎng)絡(luò)打印機(jī)連接 /dd 刪除打印機(jī)驅(qū)動(dòng)程序 /e 顯示打印首選項(xiàng) /f[file] inf 文件或輸出文件 使用 /f 指定的 INF 文件可能依賴的 INF 文件的 /F[file] 位置 /ga 添加每個(gè)機(jī)器打印機(jī)連接(用戶登錄時(shí)此連接將傳播到用戶) /ge 枚舉每個(gè)機(jī)器打印機(jī)連接 /gd 刪除每個(gè)機(jī)器打印機(jī)連接(用戶登錄時(shí)此連接將被刪除) /h[arch] 驅(qū)動(dòng)程序體系結(jié)構(gòu),為下列之一: x86 或 x64 或 Itanium /ia 用 INF 文件安裝打印機(jī)驅(qū)動(dòng)程序 /id 用添加打印機(jī)驅(qū)動(dòng)程序向?qū)О惭b打印機(jī)驅(qū)動(dòng)程序 /if 用 INF 文件安裝打印機(jī) /ii 用帶 INF 文件的添加打印機(jī)向?qū)О惭b打印機(jī) /il 用添加打印機(jī)向?qū)О惭b打印機(jī) /in 添加網(wǎng)絡(luò)打印機(jī)連接 /ip 使用網(wǎng)絡(luò)打印機(jī)安裝向?qū)О惭b打印機(jī) /j[provider] 打印提供程序名稱 /k 將測(cè)試頁打印到指定的打印機(jī),不能安裝打印機(jī)時(shí)的命令組合 /l[path] 打印機(jī)驅(qū)動(dòng)程序源路徑 /m[model] 打印機(jī)驅(qū)動(dòng)程序型號(hào)名 /n[name] 打印機(jī)名 /o 顯示打印機(jī)隊(duì)列查看 /p 顯示打印機(jī)屬性 /q 安靜模式,不顯示錯(cuò)誤信息 /r[port] 端口名 /s 顯示服務(wù)器屬性 /Ss 將打印機(jī)設(shè)置存到一個(gè)文件 /Sr 從一個(gè)文件還原打印機(jī)設(shè)置
儲(chǔ)存或還原必須放在命令結(jié)尾的打印機(jī)設(shè)置選項(xiàng)標(biāo)志:
2 PRINTER_INFO_2 7 PRINTER_INFO_7 c 顏色配置文件 d 打印機(jī)數(shù)據(jù) s 安全描述符 g 全局 DevMode m 最低設(shè)置 u 用戶 DevMode r 解決名稱沖突 f 強(qiáng)制使用名稱 p 解析端口 i 驅(qū)動(dòng)程序名稱沖突 /u 如果已安裝,則使用現(xiàn)有的打印機(jī)驅(qū)動(dòng)程序 /t[#] 起始的以零為基礎(chǔ)的索引頁 /v[version] 驅(qū)動(dòng)程序版本,為下列之一:“類型 2 - 內(nèi)核模式”或“類型 3 - 用戶模式” /w 如果在 INF 中找不到指定的驅(qū)動(dòng)程序,則提示用戶 /y 將打印機(jī)設(shè)置為默認(rèn)打印機(jī) /Xg 獲得打印機(jī)設(shè)置 /Xs 設(shè)定打印機(jī)設(shè)置 /z 不要自動(dòng)共享這臺(tái)打印機(jī) /Z 不要自動(dòng)生成打印機(jī)名 /K 更改 /h 的含義,使 x86 或 x64 或 Itanium 接受 2、3、4,并更改 /v 的含義,使“類型 3 - 用戶模式”接受 3 /Z 共享這臺(tái)打印機(jī),只能跟 /if 選項(xiàng)一起使用 /? 幫助信息 @[file] 命令行參數(shù)文件 /Mw[message] 確認(rèn)命令之前顯示警告消息 /Mq[message] 確認(rèn)命令之前顯示確認(rèn)消息 /W[flags] 指定向?qū)?APW 和 APDW)的標(biāo)志和切換 r 使向?qū)Э梢詮纳弦豁撝匦聠?dòng) /G[flags] 指定全局標(biāo)志和切換 w 抑制安裝程序驅(qū)動(dòng)程序警告 UI (超級(jí)靜聲模式)
例如:
運(yùn)行服務(wù)器屬性:
rundll32 printui.dll,PrintUIEntry /s /t1 /c//machine 運(yùn)行打印機(jī)屬性:rundll32 printui.dll,PrintUIEntry /p /n//machine/printer 本地運(yùn)行添加打印機(jī)向?qū)?rundll32 printui.dll,PrintUIEntry /il 在 //machine:rundll32 printui.dll,PrintUIEntry /il /c//machine 運(yùn)行添加打印機(jī)向?qū)? 運(yùn)行隊(duì)列查看:rundll32 printui.dll,PrintUIEntry /o /n//machine/printer 運(yùn)行 INF 安裝:rundll32 printui.dll,PrintUIEntry /if /b "Test Printer" /f c:/infpath/infFile.inf /r "lpt1:" /m "Brother DCP-128C" 運(yùn)行 INF 安裝(具有 INF 依賴關(guān)系)。在此示例中,prnbr002.inf 依賴于 ntprint.infrundll32 printui.dll, PrintUIEntry /ia /m "Brother DCP-128C" /K /h x64 /v 3 /f "c:/infpath/prnbr002.inf" /F "c:/infpath/ntprint.inf" 使用 INF 運(yùn)行添加打印機(jī)向?qū)?rundll32 printui.dll,PrintUIEntry /ii /f c:/infpath/infFile.inf 使用內(nèi)置打印機(jī)驅(qū)動(dòng)程序添加打印機(jī):rundll32 printui.dll,PrintUIEntry /if /b "Test Printer" /r "lpt1:" /m "Brother DCP-128C" 添加每個(gè)機(jī)器打印機(jī)連接(用戶登錄時(shí)此連接將傳播到用戶):rundll32 printui.dll,PrintUIEntry /ga /c//machine /n//machine/printer /j"LanMan Print Services" 刪除每個(gè)機(jī)器打印機(jī)連接(用戶登錄時(shí)此連接將被刪除):rundll32 printui.dll,PrintUIEntry /gd /c//machine /n//machine/printer 枚舉每個(gè)機(jī)器打印機(jī)連接:rundll32 printui.dll,PrintUIEntry /ge /c//machine 使用 INF 添加打印機(jī)驅(qū)動(dòng)程序:rundll32 printui.dll,PrintUIEntry /ia /c//machine /m "Brother DCP-128C" /h "x86" /v "Type 3 - User Mode" /f c:/infpath/infFile.inf 使用 INF 添加打印機(jī)驅(qū)動(dòng)程序:rundll32 printui.dll,PrintUIEntry /ia /K /c//machine /m "Brother DCP-128C" /h "x86" /v 3 添加內(nèi)置打印機(jī)驅(qū)動(dòng)程序:rundll32 printui.dll,PrintUIEntry /ia /c//machine /m "Brother DCP-128C" /h "Intel" /v "Type 3 - Kernel Mode" 刪除打印機(jī)驅(qū)動(dòng)程序:rundll32 printui.dll,PrintUIEntry /dd /c//machine /m "Brother DCP-128C" /h "x86" /v "Type 3 - User Mode" 刪除打印機(jī)驅(qū)動(dòng)程序:rundll32 printui.dll,PrintUIEntry /dd /K /c//machine /m "Brother DCP-128C" /h "x86" /v 3 將打印機(jī)設(shè)置為默認(rèn)打印機(jī):rundll32 printui.dll,PrintUIEntry /y /n "printer" 設(shè)置打印機(jī)注解:rundll32 printui.dll,PrintUIEntry /Xs /n "printer" comment "My Cool Printer" 取得打印機(jī)設(shè)置:rundll32 printui.dll,PrintUIEntry /Xg /n "printer" 取得文件中的打印機(jī)設(shè)置保存結(jié)果:rundll32 printui.dll,PrintUIEntry /f "results.txt" /Xg /n "printer" 設(shè)置打印機(jī)設(shè)置命令使用:rundll32 printui.dll,PrintUIEntry /Xs /n "printer" ? 將所有打印機(jī)設(shè)置存入一個(gè)文件:rundll32 printui.dll,PrintUIEntry /Xs /n "printer" ? 從一個(gè)文件還原所有打印機(jī)設(shè)置:rundll32 printui.dll,PrintUIEntry /Sr /n "printer" /a "file.dat" 將二級(jí)打印機(jī)信息存入一個(gè)文件:rundll32 printui.dll,PrintUIEntry /Ss /n "printer" /a "file.dat" 2 從一個(gè)文件還原打印機(jī)安全描述符:rundll32 printui.dll,PrintUIEntry /Sr /n "printer" /a "file.dat" s 從一個(gè)文件還原打印機(jī)全局 devmode 和打印機(jī)數(shù)據(jù):rundll32 printui.dll,PrintUIEntry /Sr /n "printer" /a "file.dat" g d 從文件最少設(shè)置還原并分析端口名:rundll32 printui.dll,PrintUIEntry /Sr /n "printer" /a "file.dat" m p 啟用打印機(jī)的客戶端呈現(xiàn):rundll32 printui.dll,PrintUIEntry /Xs /n"printer" ClientSideRender enabled 禁用打印機(jī)的客戶端呈現(xiàn):rundll32 printui.dll,PrintUIEntry /Xs /n"printer" ClientSideRender disabled
新聞熱點(diǎn)
疑難解答
圖片精選