variable in dos batch file

Sir
I have a very old cobol programme (source not availble). On execution and invoking some menu commands, depending upon the "pressed menu commands" it is writing certain values into a dos batch file. At the end of cobol file, this batch file gets exeuted.

On keying in the Drive from which you want to copy: I typed B (I have configured my pen-drive as "B".

The batch file gets written as under:

if exist zone%2\v@* del zone%2\v@*
COPY b:\%1 ZONE%2\v@2 > nul

On execution of this batch file

The file is not getting copied from B (pen drive) - PATH NOT FOUND is the message appears on screen.

How to sort this issue? Please help me. Thanks in anticipation.

B:\ is (or was) usually either the second floppy drive, if the PC had two, or the same floppy drive as A:\, but DOS would prompt you for the other floppy disk if you specified B:.

But now you are saying B:\ is your pendrive? Can you access files on the pendrive from a command shell (i.e. a "DOS prompt" window)? That is, if you type the command
dir B:\
does it show you the files there?

If B:\ is awkward to use, the DOS SUBST command may be useful for you. That is, if you want it to access files in C:\ZONEFILES instead of B:, you could use this command:

subst B: C:\ZONEFILES

Then any program or command that accesses B: will really access C:\ZONEFILES.

Sir, Thanks for your reply.
As I stated earlier, the values "if exist zone%2\v@* " and "COPY b:\%1 ZONE%2\v@2 > nul " are being written to the dos batch file from a cobol programme (the source not available). The earlier command of batch echo "zone%2\v@ " is displaying the Zone number and the name of the file from B:\Zone1\(file name). For another command it is displaying the contents of file from B:\Zone1. It is in fact accessing the pen drive - whose drive name has been changed to B). But when it comes to copying it to the folder in hard disk, "path not found" is the message.

Is it that the path has to be set for B:\ (pen drive) also in "environment vairable"? If so, how?
Please help me.

What is the current drive and directory when the application starts?
Is it started from a shortcut that changes the starting path?
Does the COBOL application change the current path?

The DOS command COPY b:\%1 ZONE%2\v@2 is copying to a subdirectory in the current directory of the current drive. It sounds like that directory is what's missing.

Sir, Thanks once again for prompt reply.
The current path when the relevant "dos batch file" is accessed by cobol.exe is c:\abc. On the basis of user-input, if he choses " A" or "B" drive, the values are written to the dos batch file and that drive is accessed wherein some files are sought to copied to c:\abc\nnn1 (or 2) directory. As per the batch file, it is echoing the zone directory to where the file is to be copied and the file name to be copied in the B: drive. It is also reading inside the file and displaying the contents of the file in B drive. Then it will display "Do you want to copy Y/N". When we press Y it displays "Path not find" and comes out of application. I am on Windows xp. Regret for bothering toomuch. But cant help.

Try creating some directories and then running the command:

mkdir c:\abc\ZONE1
mkdir c:\abc\ZONE2

Another thing you might consider is directly modifying a copy of the binary COBOL program. I know you don't have the source, but there is a chance you could find the text of the batch file in the executable and very carefully edit it (a copy!) with either a hex editor or a text editor that will not change line ending characters.

If those don't work, I'm out of ideas.

Is there any chance the directory u want to access in ur pen-drive has a space in its name...

like b:\New Folder...something like this.. space between.?