Specialty Forums
Security and Virus
General Hardware
CPUs/Overclocking
Networking
Digital Photo/Video
Office Software
PC Gaming
Console Gaming
Programming
Database
Web Development
Digital Home

General Forums
Windows XP
Windows Vista
Windows 95/98
Windows Me
Windows NT
Windows 2000
Win Server 2008
Win Server 2003
Windows 3.1
Linux
PDAs
BeOS
Novell Netware
OpenVMS
Solaris
Disk Op. System
Unix
Mac
OS/2

Drivers
Driver Scan
Driver Forum

Software
Automatic Updates

BIOS Updates

My Computing.Net

Solution Center

Free IT eBook

Howtos

Site Search

Message Find

RSS Feeds

Install Guides

Data Recovery

About

Home
Reply to Message Icon Go to Main Page Icon

Subject: Batch File Copy Help

Original Message
Name: CraigWalker
Date: March 13, 2008 at 09:23:46 Pacific
Subject: Batch File Copy Help
OS: 5.1.2600 Service Pack 2 B
CPU/Ram: x86 Family 15 Model 2 Ste
Model/Manufacturer: Hewlett-Packard/HP d330 u
Comment:
I know this isn't exactly a DOS question but this seemed like the best place to post.

I currently send files to my printer with a batch file.
copy /b %1 \\PATH_TO_PRINNER\PRINTER

I either drag a file onto this batch or use it in the "SendTo".

This works fine, however I want to modify this to do one of two things.

After the copy is complete I want to rename or move the file %1 to show that it has been printed.

If I move the file I want to create a dir named PRINTED in the DIR where %1 sits and then move it in there.

If I rename the file I want to append _Printed after the filename but before the extension.

I have thought about deleting the file %1 after printing, therefore I know it's been printed because it is no longer available but in some instances I may need to reprint the file, that is why I need to rename or move.

Is this possible? If it is I would appreciate help doing this.

Thanks


Report Offensive Message For Removal

Response Number 1
Name: IVO
Date: March 13, 2008 at 10:14:47 Pacific
Subject: Batch File Copy Help
Reply: (edit)
copy /b %1 \\PATH_TO_PRINNER\PRINTER
if not exist %~dp1\PRINTED MD %~dp1\PRINTED
move %1 %~dp1\PRINTED

Report Offensive Follow Up For Removal

Response Number 2
Name: CraigWalker
Date: March 14, 2008 at 01:36:02 Pacific
Subject: Batch File Copy Help
Reply: (edit)
Thanks for your input IVO.

This works on directorys without any spaces in the name. I.E. J:\LaserPrint\TEST\ but when you introduce spaces in the path it gives this error.

C:\>copy /b "J:\LaserPrint\TEST\TEST WITH SPACE\TEST.001" \\Offfileserver\HP8150DNO
1 file(s) copied.

C:\>if not exist J:\LaserPrint\TEST\TEST WITH SPACE\\PRINTED MD J:\LaserPrint\TEST\TEST WITH SPACE\\PRINTED
'WITH' is not recognized as an internal or external command, operable program or batch file.

C:\>move "J:\LaserPrint\TEST\TEST WITH SPACE\TEST.001" J:\LaserPrint\TEST\TEST WITH SPACE\\PRINTED
The syntax of the command is incorrect.

C:\>pause
Press any key to continue . . .


I have just corrected your code by placing quote marks around the path.

copy /b %1 \\Offfileserver\HP8150DNO
if not exist "%~dp1\PRINTED" MD "%~dp1\PRINTED"
move %1 "%~dp1\PRINTED"

Thanks for your help IVO.


Report Offensive Follow Up For Removal

Response Number 3
Name: CraigWalker
Date: March 14, 2008 at 07:46:40 Pacific
Subject: Batch File Copy Help
Reply: (edit)
With IVO's highlighting %~dp1 I was able to find more info about that command.

I found a webpage that explained quite a few of these commands and I was able to find how to split the filename variable.
The webpage is http://weblogs.asp.net/jgalloway/ar...

So my final code is this;
copy /b %1 \\Offfileserver\HP8150DNO
set FileNameOnly=%~n1
set FileExtension=%~x1
set FileNameWithExt=%~nx1
if not exist "%~dp1\LASERED SEGMENT DUMP" MD "%~dp1\LASERED SEGMENT DUMP"
move %1 "%~dp1\LASERED SEGMENT DUMP"
cd "%~dp1\LASERED SEGMENT DUMP"
ren %FileNameWithExt% "%FileNameOnly%_Lasered%FileExtension%"

This copies the file to the printer in binary. (Prints)
Then creates a directory called LASERED SEGMENT DUMP if it doesn't exist.
Then moves the file to the directory and finally renames the file appending _Lasered after the filename but before the extension.

Everything I was looking for.

Thank you IVO.


Report Offensive Follow Up For Removal



Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Batch File Copy Help

Comments:

 
  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 


Data Recovery Software



Version Tracker Pro
Keep your software current and secure, effortlessly

Click Here for a Free Scan

Driver Agent
Automatically find the latest drivers for your computer.
Click Here for a Free Scan



The information on Computing.Net is the opinions of its users. Such opinions may not be accurate and they are to be used at your own risk. Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE

All content ©1996-2007 Computing.Net, LLC