2 wuzangji0642 wuzangji0642 于 2018.04.16 23:47 提问

batch控制打印pdf,同一.bat文件,win7可以正常执行,XP执行不了 40C

@echo OFF
set reader_path="C:\Program Files\Adobe\Acrobat 4.0\Reader\AcroRd32.exe"
set printer_name=RICOH SP 3610SF PCL 6_2
set finish_path="C:\print_report\FINISHED"
set start_reader_path="C:\Program Files\Adobe\Acrobat 4.0\Reader"
 
set LOGFILE="C:\Print_1.log"
 
start %start_reader_path% AcroRd32.exe
 
ECHO Please Input Your File Path >> %LOGFILE%
ECHO Please Input Your File Path
set /p Input= 
ECHO %Input% >> %LOGFILE%
if exist "%Input%" (
    echo File Path Is Correct!Start Printing >> %LOGFILE%
    echo File Path Is Correct!Start Printing
    GOTO PRINT_D
) else (
    echo Sorry,Your File Path Is Incorrect!Please Check Again >> %LOGFILE%
    echo Sorry,Your File Path Is Incorrect!Please Check Again
    GOTO END

:PRINT_D 
CD %Input%
setlocal EnableDelayedExpansion
SET /A COUNT_1=0

    FOR /R %%s in (*.pdf) do ( 
        ECHO PRINTING %%s >> %LOGFILE%
        ECHO PRINTING %%s
        SET /A COUNT_1+=1
        %reader_path% /t "%%s" "%printer_name%"
    )
FOR /R %%s in (*.pdf) do ( 
copy "%%s" "%finish_path%"
    )

ECHO PRINTING IS FINISHED,Total Files %COUNT_1% >> %LOGFILE%
ECHO PRINTING IS FINISHED,Total Files %COUNT_1%
 
 
:END

XP里主要就是这一句执行不了 %reader_path% /t "%%s" "%printer_name%"
如果修改,规定要使用XP的系统

1个回答

caozhy
caozhy   Ds   Rxr 2018.04.16 23:57

把 @echo OFF 这个去掉
或者换成
@echo ON

然后在命令行里调用,这样可以输出所有错误信息。
另外,可以分行写,看看哪些执行是不对的。

特别检查下权限、路径等问题。你确认你xp里安装acrobat 4了么

wuzangji0642
wuzangji0642 回复caozhy: 解决了adobe reader版本太旧,打不开测试pdf,换一个就可以了
9 天之前 回复
caozhy
caozhy 回复wuzangji0642: 打印机名字是什么,打印机安装了么
9 天之前 回复
wuzangji0642
wuzangji0642 分行写,一样没有错误,acrobat4路径没有问题,是不是 /t以及 printer_name的问题,printer名要加什么符号么,还是要加一些port等信息
9 天之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!