Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RUN doesn't run batch file

Status
Not open for further replies.

justamistere

Programmer
Jul 25, 2002
67
US
I try to run a "RUN PRNRPT.BAT" It is a batch file containing "COPY *.rpt \\xxx\hplaserj". The DOS window pops up and closes right away. The DOS window is empty. Any suggestions or alternatives to copying files to a network printer?
 
DECLARE INTEGER ShellExecute IN shell32.dll ;
INTEGER hndWin, ;
STRING cAction, ;
STRING cFileName, ;
STRING cParams, ;
STRING cDir, ;
INTEGER nShowWin

cFileName = "PRNRPT.BAT"
cAction = "open"

ShellExecute(0, cAction, cFileName, "", "", 1)
 
sometimes it's helpful to use the CMD.exe or Command.com shells:

Code:
lcCmd = GETENV('COMSPEC')
RUN &lcCmd /C COPY *.rpt \\xxx\hplaserj
 
I would like to share my experience with you

Under Windows NT
I will define NET USE LPT1 \\xxx\hplaserj in the login script (if any change, just simply change the login script, it doesn't need to change the program or else)
Als if more than one printer defined, I will define one more command line in the login script just like NET USE LPT2 \\xxx\hplaserj2. Users could select either LPT1 or LPT2 from the program.

In the program, just as other said - RUN COPY printout.txt > LPT1 or using variable cDevice storing either "LPT1" or "LPT2". RUN COPY printout.txt > &cDevice.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top