send .bat file to network barcode printer

yvonne
Member Posts: 31
:? I failed to print barcode from workstation (navision3.7) to barcode printer which attached with server.
I generate my .bat file at my c: drive though below coding --
Test.CREATE('C:\BatchName.bat');
Test.write('xxxx')
Test.Close
The barcode can print out through command prompt--
C:\>copy batchName.bat \\172.28.7.246\SATO
But it can't print from Nav, please point out my mistake -- :oops:
SHELL('copy', 'C:\BatchName.bat', '\\172.28.7.246\SATO');
Error Prompt: Operating System cannot find the file copy.
please help..
I generate my .bat file at my c: drive though below coding --
Test.CREATE('C:\BatchName.bat');
Test.write('xxxx')
Test.Close
The barcode can print out through command prompt--
C:\>copy batchName.bat \\172.28.7.246\SATO
But it can't print from Nav, please point out my mistake -- :oops:
SHELL('copy', 'C:\BatchName.bat', '\\172.28.7.246\SATO');
Error Prompt: Operating System cannot find the file copy.
please help..

0
Comments
-
Copy is an internal command from the commandshell. So you need to start the commandshell (on NT systems cmd.exe, on 9x systems command.exe). The proper line would be something like
SHELL(environ(comspec), '/c copy C:\BatchName.bat \\172.28.7.246\SATO');0 -
It work. Thank you very much, Poltergeist.
0 -
i am facing same problem for FTP.
this command
SHELL('ftp','-s:' + FTPScriptFName, FTPServer);
it says "operating system cannot find the file ftp.
so i changed to
SHELL(ENVIRON('comspec'), 'ftp' + ' ' + '-s:' + FTPScriptFName + ' ' + FTPServer
but the command prompt screen came out with this path
C:\Program Files\ Microsoft business Solution-Navision\Client>
then stopped there waiting for me to type command.
1. I am sure FTPScriptFName and FTPServer values are valid
2. I am sure there are FTP.exe in my PC because I can run FTP command from DOS0 -
After the Environ('comspec'), you need to use a /c, to indicate the command to be started, and that the window has to close when it's ready. If you do not use /c, the command shell is started, but nothing will happen (like what's happening now)
your command should be:
SHELL(ENVIRON('comspec'), ' /c ftp' + ' ' + '-s:' + FTPScriptFName + ' ' + FTPServer
FTP.EXE is indeed on your PC, so there should be no need to start the command shell. Usually, FTP.EXE is in ENVIRON('SYSTEM ROOT')+'\system32'. You should be able to run the program with
SHELL(ENVIRON('SYSTEM ROOT'')+'\system32\FTP.EXE','+'-s:' + FTPScriptFName + ' ' + FTPServer'. Haven't tried that myself, though.0 -
i added /c and the screen close almost immediately, the script was wrong, but I was not able to see the error message. Any idea to pause the screen?0
-
Use /k instead of /c. The program will start, but when it's finished, the command shell is not closed.0
-
1. the error was "cannot open the script file" because after the shell command, it continues the next statement to delete the script file (the script file was meant to be deleted after the ftp process). i need a way to make the ftp process "modal", so that the program delete statement only run after the DOS screen closes.
2. any other switch (like /k, /s) to let the user to see the process and at the end prompt "press any key to continue..."0 -
I believe the shell command has an option to run modal...
Or use something like
SHELL(ENVIRON('comspec'), chr(34)+'ftp' + ' ' + '-s:' + FTPScriptFName + ' ' + FTPServer'+chr(34)+"&&"+chr(34)+"del FTPScriptname"
Then the DEL command is operated after the the FTP command. Use && to execute multiple commands.0 -
Dear Poltergeist, thanks for reminding me, the shell command has the option to run modally... i check out the help, just need to assign the shell command to a return code.
and I put "PAUSE" as the subsequent command for "press any key to continue..."
thanks again, now I can sleep tonite. =D>0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions