🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.msdos.programmer
Article #1135

Re: calling batch file from C prog

#1135
From: Craig Lovegren
Date: Wed, 02 Aug 1995 07:10
34 lines
1751 bytes
Why not just run the initial program from a batch file.  That is...

rem This batch file will start the program and alter the ENVIRONMENT
@echo off
myprog.exe
call change.bat
rem This is the end of the batch file

Now... as myprog.exe runs it creates a text file to be run as a batch 
file called change.bat.  All it needs to do is something like this...

if it needs to change something, create a file that has...

@echo off
echo Setting variable to constant
set VARIABLE=CONSTANT
...
...

if it doesn't need to change something, just write one that says...

@echo off
echo Not changing a thing... :)
echo;

And thats it.  Since you are not changing the original batch file DOS 
won't complain about not finding the batch file and since it hasn't run 
the second batch file when the program terminates your changes will be made.

-- 
------------==============/(*)\==============------------
|                    Craig Lovegren                     |
|                 craigl@teleport.com                   |
------------==============\(*)/==============------------
Technical Details
Message-ID: <3vn8d6$1ue@linda.teleport.com>
Path: arc1-ca.pugleaf.net!nntp.teleport.com!not-for-mail
References: <D93H3A.tv@bashful.demon.co.uk> <3q0107$j4p@news.iag.net> <etznlG0d8L2I075yn@goofy.iaccess.za> <DCM7sz.EA1@icis.on.ca> <3vlrbk$gv7@news.iag.net>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!nntp.teleport.com!not-for-mail
From: craigl@teleport.com (Craig Lovegren)
Newsgroups: alt.msdos.programmer,comp.os.msdos.programmer,comp.lang.c
Subject: Re: calling batch file from C prog
Followup-To: alt.msdos.programmer,comp.os.msdos.programmer,comp.lang.c
Date: 2 Aug 1995 00:10:30 -0700
Organization: Teleport - Portland's Public Access (503) 220-1016
Message-ID: <3vn8d6$1ue@linda.teleport.com>
References: <D93H3A.tv@bashful.demon.co.uk> <3q0107$j4p@news.iag.net> <etznlG0d8L2I075yn@goofy.iaccess.za> <DCM7sz.EA1@icis.on.ca> <3vlrbk$gv7@news.iag.net>
NNTP-Posting-Host: linda.teleport.com
X-Newsreader: TIN [version 1.2 PL2]