vbscriptcmdlpr

vbsscript run cmd command with parametrs


I have a folder in witch .pcl and .ps files are written.

I want those files to be printed, the only possibillity to do this if found is cmd LPR command

the script is:

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

How can i pass attributes as currentPath or files.name to cmd line command?


Solution

  • Try building the string like:

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

    (not sure if you need all the brackets etc)