Computing.Net > Forums > Disk Operating System > How to execute a .cfg file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

How to execute a .cfg file

Reply to Message Icon

Name: Stefan Perdal
Date: November 21, 2003 at 01:01:42 Pacific
OS: Windows NT 4.0
CPU/Ram: P3@1Ghz/128 Mb
Comment:

How do I execute a file that doesn't have the file extension .bat? I want to execute a .cfg that contains a lot of set variables.



Sponsored Link
Ads by Google

Response Number 1
Name: IVO
Date: November 21, 2003 at 02:10:40 Pacific
Reply:

Just copy it renaming the destination file with the .bat extension and then run it. I assume, as you posted, the .cfg file contains executable batch commands and comment lines.


0

Response Number 2
Name: Stefan Perdal
Date: November 21, 2003 at 03:23:59 Pacific
Reply:

It's like this. I have a main blabla.bat file with the script itself. I want that script to read all the variables from the blabla.cfg So other people easy just can change the config file. And also wan other scripts to read from the same config file aswell.


0

Response Number 3
Name: IVO
Date: November 21, 2003 at 04:52:07 Pacific
Reply:

To help you, a more accurate description of the content of the config file is needed, as the way the main batch has to exploit to access the related configuration script is bound to the .cfg structure.


0

Response Number 4
Name: Stefan Perdal
Date: November 21, 2003 at 07:51:12 Pacific
Reply:

Some examples...
main.bat
copy %1% %outdir%%1%

And the configfile..
main.cfg
set outdir=c:\batman\



0

Response Number 5
Name: IVO
Date: November 21, 2003 at 12:49:16 Pacific
Reply:

According to your post, the best way to accomplsh what you want under Windows NT/2K/XP is to use the following statement

For /F "tokens=*" %%A in (Main.cfg) Do %%A

That assumes Main.cfg contains executable statements only (as your Set...)

Otherwise if you want to mantain compatibility with the DOS-kernel Windows 9X/ME, you have to turn to the less cool

Copy Main.cfg MainCfg.bat
Call MainCfg
Del MainCfg.bat



0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: How to execute a .cfg file

How to create a log file in 1 line www.computing.net/answers/dos/how-to-create-a-log-file-in-1-line/12735.html

checking a file date to execute a batch file www.computing.net/answers/dos/checking-a-file-date-to-execute-a-batch-file/1909.html

How to Make a .bat file 2 run programs on usb www.computing.net/answers/dos/how-to-make-a-bat-file-2-run-programs-on-usb/16975.html