Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
989 views
in Technique[技术] by (71.8m points)

netsuite - Printing ZPL file using Batch File Issue

We run NetSuite for our shipping software and use Zebra ZP450 printer to print the thermal label. The software downloads a .zpl file which I have assigned to run with a batch file, script here:

Net use LPT2: \%ComputerName%ebraFedex

Copy %1 LPT2

Net use LPT2: /Delete

I have installed this on probably 20 or more computers without an issue. But the last two will initiate the batch file but not print.

I was able to hit pause on the batch file and here is what I got:

C:users oahdownloads et use LPT2: (ComputerName)ebraFedex

The command completed successfully

C:UsersNoahDownloadsCopy LPT2

The system cannot find the file specified. 0 files copied

C:UsersNoahDownloads>Net use LPT2: /Delete

I've checked my file association, which seems correct since I see the command prompt flash on the screen. I have no idea here...

Here is the screenshot of the batch file working successfully on another computer

Working successfully on another computer

Here is the screenshot of the batch file not working

Problem on puzzling computer

question from:https://stackoverflow.com/questions/66053516/printing-zpl-file-using-batch-file-issue

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Here's my batch to transfer file to my venerable TLP2844:

@ECHO OFF
SETLOCAL
FOR %%a IN (%*) DO (
 IF EXIST "%%a" (COPY /b "%%~a" \%computername%TLP2844
 ) ELSE (
  IF EXIST "%%a.txt" (
   COPY /b "%%~a.txt" \%computername%TLP2844
  ) else (
   ECHO Neither "%%a" nor "%%a.txt" appears to EXIST
  )
 )
)

where I have a printer called TLP2844 installed as a ZDesigner TLP 2844 device on USB003.


The problem, as shown by the graphics I've included in your question (saves running off chasing links) is that the label file C:usersmelandownloadsUPSSHIPPINGLABEL1700448.zpl is being provided to the batch as %1 (first parameter). On the problem installation, no filename (presumably C:usersNoahdownloadsUPSSHIPPINGLABEL???????.zpl is being provided to the batch as %1.

Therefore it's not a batch problem, but a problem with Netsuite.

From your .pdf, on page 26 :

To install a thermal printer driver on a Windows PC: ... 5. In the Share Name field, enter the name of the printer. For example, LP 2844. The printer name cannot contain spaces.

So you're told the printer name cannot contain spaces, but the example printer name contains a space....Excellent! (shows my level of confidence in the product, but not actually directly relevant to the problem) :(

Personally, I'd change your batch file to

Copy %1 \%ComputerName%ebraFedex

Perhaps you'd try that after fixing the problem where Netsuite fails to deliver the filename to the batch. Perhaps it's set up to produce .pdfs on the computer in question (That's a wild guess)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...