【问题标题】:vbsscript run cmd command with parametrsvbscript 运行带参数的cmd命令
【发布时间】:2015-10-05 21:01:18
【问题描述】:

我有一个文件夹在 wwitch .pcl 和 .ps 文件中写入。

我希望打印这些文件,如果找到的话,唯一的可能是 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 传递给命令行命令?

【问题讨论】:

标签: vbscript cmd lpr


【解决方案1】:

尝试像这样构建字符串:

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

(不确定是否需要所有括号等)

【讨论】:

  • 谢谢!结束于:oShell.run "cmd.exe /C LPR -S "&amp; printerHost &amp;" -P "&amp; printerName &amp;" " &amp; currentPath &amp; "\" &amp; files.name &amp; " "
猜你喜欢
  • 1970-01-01
  • 2011-07-24
  • 1970-01-01
  • 2013-06-08
  • 2013-06-08
  • 1970-01-01
  • 1970-01-01
  • 2019-08-15
  • 1970-01-01
相关资源
最近更新 更多