2015-10-05 186 views
0

我有一個文件夾在女巫.pcl和.ps文件被寫入。vbsscript用參數運行cmd命令

我要打印這些文件,唯一possibillity這樣做,如果發現是cmd LPR命令

的腳本是:

set shApp = CreateObject("shell.application") 
Set oShell = WScript.CreateObject ("WScript.Shell") 
currentPath = "c:\printAll\" 
set shFolder = shApp.NameSpace(currentPath) 
set files = shFolder.Items() 
for each files in files 

    if files.name <> "printAll" then 
     'msgbox("printing "&files.name) 
           oShell.run "cmd.exe /C LPR -S SRV00APP.N-IX.LOCAL -P HP400MFP #{shFolder}/#{files.name} " 


    end if 
next 

如何傳遞的屬性currentPathfiles.name以cmd命令行?

+0

[字符串拼接](https://msdn.microsoft.com/en-us/庫/ sx97884w(v = vs.84)的.aspx)? – Lankymart

+0

謝謝你的工作! –

回答

1

嘗試建立字符串,如:

oShell.run "cmd.exe /C LPR -S SRV00APP.N-IX.LOCAL -P HP400MFP #{" & shFolder & "}/#{" & files.name "} " 

(不知道你所需要的所有支架等)

+0

謝謝!以「oShell.run」cmd.exe/C LPR -S「&printerHost&」-P「&printerName&」「&currentPath&」\「&files.name&」「 –