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

Batch file command

Original Message
Name: 1Tech
Date: June 28, 2005 at 03:13:09 Pacific
Subject: Batch file command
OS: 98SE
CPU/Ram: XP2800+/512
Comment:
I'm writing a Batch file that copies a 695 meg file from the CD to the C: drive (checks to see if the entire file actually coppied) then prompts the user to unsert the next CD to copy the next file. The only trouble I'm having is how to (Check to see if the entire file actually coppied)... I need something in the batch file that compares the size of two files, and if they are the same, then it exits with errorlevel=0, and if not, errorlevel=1. I greatly appriciate any help anyone can give me on this!! Thank's in advance, 1Tech

Report Offensive Message For Removal


Response Number 1
Name: Mechanix2Go
Date: June 28, 2005 at 03:28:52 Pacific
Subject: Batch file command
Reply: (edit)
@echo off
:main
fc c:\filename r:\filemame > nul
if errorlevel 1 goto error

:next
echo insert next CD
pause
goto main

:error
echo failed check

M2


If at first you don't succeed, you're about average.


Report Offensive Follow Up For Removal

Response Number 2
Name: Mechanix2Go
Date: June 28, 2005 at 03:30:46 Pacific
Subject: Batch file command
Reply: (edit)
oops,

I assume they're binary, so:

fc /b c:\filename r:\filemame

M2


If at first you don't succeed, you're about average.


Report Offensive Follow Up For Removal

Response Number 3
Name: 1Tech
Date: June 28, 2005 at 04:24:45 Pacific
Subject: Batch file command
Reply: (edit)
I thank you for your effort Mechanix2Go. I tried the FC command with and without the binary switch /b and it never goes to error, allways goes to next, even when the file that I told it to copy does not exist on the R: (CD) drive. This is a 695 meg file it is comparing though. I get the feeling from the HELP FC listing that this command looks at both files line by line and not just their file sizes. I'm stumped. Any ideas?

Report Offensive Follow Up For Removal

Response Number 4
Name: Mechanix2Go
Date: June 28, 2005 at 04:49:06 Pacific
Subject: Batch file command
Reply: (edit)
Hi,

I'm a little bit at a disadvantage here because I'm running NT. I have 9x and 6x, but don't want to reboot right now.

I would HOPE that the /b does not simply do a size check, but actually compares byte for byte.

I just altered a small test file by adding a space.

Here's the out put:

::===============
C:\temp\->fc /b t.bat t2
Comparing files T.BAT and T2
FC: T2 longer than T.BAT
::================

So if it's only comparing size, that's pretty dumb.

I altered it again so they are the same SIZE, but different.

Here's the output:

::============
0000004D: 66 69
0000004E: 69 6C
0000004F: 6C 65
00000050: 65 20
::=============
Which means it actually compares bytes, but [weird] sets errorlevel 0!

You could use VERIFY, which is supposed to ensure that a file is written correctly. Not obvious is what happens if it is NOT.

If you want to stick to plain w98, I'm out of suggestions for the moment.

If you can use 3rd party utils, life gets easier.

M2


If at first you don't succeed, you're about average.


Report Offensive Follow Up For Removal

Response Number 5
Name: chrisintx
Date: June 29, 2005 at 10:48:38 Pacific
Subject: Batch file command
Reply: (edit)
Hello all....newbie here...trying to build a simple batch file that could ping my computers and write to a file things like IP address, mac address...thanks

Report Offensive Follow Up For Removal


Response Number 6
Name: Mechanix2Go
Date: June 29, 2005 at 10:55:54 Pacific
Subject: Batch file command
Reply: (edit)
Hi Chris,

As that is a new subject, you need to start a new thread.

If it's not DOS, it doesn't belong here.

Best place for batch / script issues is the programming forum.

When you get there you need to be specific about your OS and about the requirement.

HTH

M2


If at first you don't succeed, you're about average.


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 command

Comments:

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


Data Recovery Software




DSHUB24 Connection Problems

need help with dsl and dial up

novel 3.12

help mandriva install last straw!

Icon Scaling in Explorer Bar


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