Variables in DOS batch files 
Author Message
 Variables in DOS batch files

I have a number of DOS programs that I want to tie together in a shell
program to automate. A problem I am having is trying to input file
variables into the programs in a DOS batch file. They work OK if you
specify the filename but not if you put in a variable.
The syntax I am using is as follows:

file$ = "c:\filen.ame"  

DOS returns "Bad command or file name"

I am running Windows 95 and only have Command.com in my root directory. Do
I need to have a full DOS directory or are there some files I am missing to
be able to use variables in Batch files?



Tue, 18 Jan 2000 03:00:00 GMT  
 Variables in DOS batch files

Quote:

> I have a number of DOS programs that I want to tie together in a shell
> program to automate. A problem I am having is trying to input file
> variables into the programs in a DOS batch file. They work OK if you
> specify the filename but not if you put in a variable.
> The syntax I am using is as follows:

> file$ = "c:\filen.ame"

> DOS returns "Bad command or file name"

> I am running Windows 95 and only have Command.com in my root directory. Do
> I need to have a full DOS directory or are there some files I am missing to
> be able to use variables in Batch files?

        Yes, DOS (even under Win95!) *requires* that you identify the file.name
COMPLETELY. If that file is not in the Root Directory, as you indicate above, then you
*must* add the entire PATH to that file or DOS won't be able to find it.
--
<<< Wes Martin >>> Father, Husband, Author, LAN Tech, Vietnam Vet.
Opinions are dubious artifacts not normally given the time of day.

PGP Fingerprint = 32 2D BC 62 9B 12 F5 B4  AB 28 A8 C4 17 E2 32 76


Tue, 18 Jan 2000 03:00:00 GMT  
 Variables in DOS batch files

Quote:

>I have a number of DOS programs that I want to tie together in a shell
>program to automate. A problem I am having is trying to input file
>variables into the programs in a DOS batch file. They work OK if you
>specify the filename but not if you put in a variable.
>The syntax I am using is as follows:

>file$ = "c:\filen.ame"  

>DOS returns "Bad command or file name"

DOS batch files don't use BASIC style variables.  Use the SET command
instead.

set filename = c:\filen.ame

There is a lot to more to batch programming than most people ever
learned in DOS.

Visit my source code page at http://www.mindspring.com/~johnecarter
Visit my favorite school at http://www.mindspring.com/~addison

Get PR-Tracker -- tracks problem reports, defects, bugs
INFORMATION:  http://www.prtracker.com/info.html
DOWNLOAD:     http://www.prtracker.com/download.html



Wed, 19 Jan 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Pass Javascript variable to DOS Batch File

2. Send a variable to a DOS batch file?

3. Help: hiding a DOS window when executing a DOS batch file

4. question on hiding a DOS window when executing a DOS batch file

5. DOS Batch File to Copy Files from an Access Application

6. Bad Command or File name when Shelling DOS Batch File

7. VBScript to replace DOS Batch that deletes old files

8. How to open my local MS-DOS batch file

9. Start dos batch file from a VB application

10. How to run batch file in DOS window

11. Running DOS Batch file (in WinNT) from VB3

12. How do I call a ms-dos batch file from VB

 

 
Powered by phpBB® Forum Software