1.

Solve : a batch with blank spaces in between?

Answer»

how to CREATE a batch with copy as header and end with lpt1?
copy space space lpt1
so when i click on it, it will run, but not stop/end, then i can enter my file name in between the space space, then it run only when i hit enter key..
Im afraid I cannot even guess what you want!

Are you trying to get user input ? if so, use Set /Pwhen i click the .bat file, it will call the cmd.exe then at the cmd, it auto insert "copy   lpt1" but the line will not run, until i type my file name in between, like "copy 1.txt lpt1".
then i hit enter key, cmd will send my file...But what happens if your filename is too long for the available "blank space" in your request?
so i cannot insert any file name??
or any way to allow user drag and drop file over, then it will inserted ?what's wrong with the PRINT command?
1. Save to desktop as .bat or .cmd file (name as you like)
2. To use, drag and drop file onto icon.

Code: [Select]copy "%1" lpt1:I use this
copy "%1" lpt1:
pause

 but not working

The system cannot find the file specified.

C:\>pause
Press any key to continue . . . Code: [Select]copy "%~dpnx1" lpt1:copy "%~dpnx1" lpt1:
not working too............ Code: [Select]echo off
echo File to copy: "%~dpnx1"
pause
copy "%~dpnx1" lpt1:
pause

Please post what you see on screen (by copying and pasting)
File to copy: "C:\urban.txt"
Press any key to continue . . .

nothing happend when i press any keyYou SAY "nothing happened". Please say what you are EXPECTING to happen.

a. Is "C:\urban.txt" the file you dragged and dropped? (i.e. are the path and filename correct?)
b. Does your computer have a parallel port which is enabled in the BIOS and is there a device such a printer properly connected to it and switched on?
c. Do you get to the second Press any key message?
d. What operating system are you running?

Please try this and post results as before...

Code: [Select]echo off
echo 1 File to copy: "%~dpnx1"
pause
echo 2 Copying file to printer port
copy "%~dpnx1" lpt1:
echo 3 Printer finished
pause


Quote from: Salmon Trout on July 25, 2010, 12:53:59 AM

You say "nothing happened". Please say what you are expecting to happen.

a. Is "C:\urban.txt" the file you dragged and dropped? (i.e. are the path and filename correct?)
yes, i drag and drop, both .bat and urban.txt are located at desktop
b. Does your computer have a parallel port which is enabled in the BIOS and is there a device such a printer properly connected to it and switched on?
i think i found the problem, now i CHANGE my adobe print to lpt1...semms working...
c. Do you get to the second Press any key message?
yes
d. What operating system are you running?
XP
Code: [Select]1 File to copy: "C:\urban.txt"
Press any key to continue . . .
2 Copying file to printer port
        1 file(s) copied.
3 Printer finished
Press any key to continue . . .
how to make the cmd do not close after i press any key?
so i can drag and drop the file while cmd window open...


Discussion

No Comment Found