variable in dos batch file


 
Thread Tools Search this Thread
Special Forums Windows & DOS: Issues & Discussions variable in dos batch file
# 1  
Old 07-12-2008
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.
# 2  
Old 07-12-2008
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.
# 3  
Old 07-13-2008
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.
# 4  
Old 07-13-2008
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.

Last edited by KenJackson; 07-13-2008 at 08:34 PM.. Reason: Typo
# 5  
Old 07-13-2008
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.
# 6  
Old 07-13-2008
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.
# 7  
Old 08-29-2008
variable in dos batch file

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.?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Converting DOS Batch file to Shell Script

Hi, This is my DOS Batch file. @echo off echo "Program Name :" %0 rem echo "Next param :" %1 echo "Next param :" "Username/Password" echo "User Id :" %2 echo "User Name :" %3 echo "Request ID ... (4 Replies)
Discussion started by: Rami Reddy
4 Replies

2. Shell Programming and Scripting

Dos batch script to execute unix shell script

Can anyone help me with a dos batch script to execute a shell script residing in an unix server. I am not able to use ssh. Thanks in advance (2 Replies)
Discussion started by: Shri123
2 Replies

3. UNIX for Dummies Questions & Answers

Unix shell, Dos batch

Is the unix shell script equivalent to dos batch command? Thanks (2 Replies)
Discussion started by: zhshqzyc
2 Replies

4. Shell Programming and Scripting

HowTo translate KSH Scripts to DOS Batch Files ?

Hi there, in near future I have to change my work surrounding from HP UNIX to Windows Vista (great to get rid of old hardware :), but bad to loose UNIX :( ). As I heavily use KSH scripts to do my job, I was wondering, if there is any HowTo available, supporting me in re-writing the scripts to... (4 Replies)
Discussion started by: Joe-K7
4 Replies

5. Shell Programming and Scripting

Delete last character in dos file

Hi, I am creating a file using an unix script and then converting it to dos format. After conversion a ^Z character is added at the end of file. I want remove this last ^Z character. Can anyone please tell me how to do this? Thanks a lot. Sunil (7 Replies)
Discussion started by: ssmallya
7 Replies

6. Windows & DOS: Issues & Discussions

Can DOS close an open file?

I'm trying to setup a cron job for my brother that goes out to the web and retrieves an excel file and overwrites the existing copy on his desktop. The problem I'm facing is I have to kill the process (excel.exe) if the file is open while the batch file runs, otherwise, it will create another copy... (2 Replies)
Discussion started by: quattro20v
2 Replies

7. UNIX for Dummies Questions & Answers

DOS batch file to capture routers log

Hi, Please help to write DOS /Perl script to capture router AAA logs to store in file. RADIUS: id 1, priority 1, host 59.163.6.103, auth-port 1901, acct-port 1902 State: current UP, duration 1928071s, previous duration 0s Dead: total time 2798488914s, count 0 Authen:... (0 Replies)
Discussion started by: patilanna
0 Replies

8. Windows & DOS: Issues & Discussions

dos batch script

We need to write a dos batch script that does following in order numbered below: Connect to all UNIX boxes using IP,userid and password from a file. validate if login was successful check if there is at least 30mb disk space in the home folder of the user Check if there are any processes... (3 Replies)
Discussion started by: chandraachii
3 Replies

9. Windows & DOS: Issues & Discussions

dos batch script

Please dont post duplicate threads :confused: (0 Replies)
Discussion started by: lorcan
0 Replies

10. Shell Programming and Scripting

Converting Shell script to Dos batch files

Hi friends! I am having some simple shell script files to build postgresql database and all. Now i want to convert those scripts to dos batch scripts(to run on windows XP/2000/NT) because there is no need of unix emulation for latest release of postgresql. Please somebody help me. (1 Reply)
Discussion started by: darwinkna
1 Replies
Login or Register to Ask a Question