🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.msdos.programmer
Article #1137

Re: calling batch file from C prog

#1137
From: David C. Wright
Date: Thu, 03 Aug 1995 01:48
35 lines
2314 bytes
In alt.msdos.programmer article <DCM7sz.EA1@icis.on.ca>,
ht108@newshost.hometown.on.ca (Matthew Busigin) wrote:
> Dale Nurden (dalen@goofy.iaccess.za) wrote:
> : In article <3q0107$j4p@news.iag.net>,
> : jatmon@mail.iag.net (John R Buchan (jatmon)) wrote:
> : > In article <D93H3A.tv@bashful.demon.co.uk>, root@bashful.demon.co.uk says...
> : > >Im trying to call a batch file from the end of a C program, using either
> : > >system, spawn?? or exec?? , and my problem is that although the batch file
> : > >runs, it is given a copy of the parents environment, that is much smaller 
> : > >than it should be, and I am unable to ut any new environment variable in.

...

> : The solution I use is a small TSR program I got from someone in this group
> : (I can't remember who offhand - it's in the docs - sorry!) which basically
> : fixes the problem. Don't ask how, it just does. I'll mail/post it if you
> : like - I have the authors permission to do so.

If you have problems with environment space in a spawned program, there is
a cheap trick that I think will work - you'd have to test it out.  Use this
command to spawn the batch file "script.bat":

system("c:\dos\command.com /E:1024 /K script.bat");

This should force the environment size to 1K (change the 1024 to alter the
size), and then execute script.bat in that particular command.com.  It
costs about 3 minutes to find out if it works, so it's worth a try.  I've
used this trick to solve similar problems running script files from
windows, but I never tried it in DOS.  Good luck, and let me know if it
works.

--
              David C. Wright | wrightd@merlin.magic.mb.ca

        And God said: E = *mv* - Ze*/r ...and there *WAS* light!
Technical Details
Message-ID: <plAIw0zpkHXT084yn@merlin.magic.mb.ca>
Path: arc1-ca.pugleaf.net!news.magic.mb.ca!not-for-mail
References: <D93H3A.tv@bashful.demon.co.uk> <3q0107$j4p@news.iag.net> <etznlG0d8L2I075yn@goofy.iaccess.za> <DCM7sz.EA1@icis.on.ca>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!news.magic.mb.ca!not-for-mail
From: wrightd@merlin.magic.mb.ca (David C. Wright)
Newsgroups: alt.msdos.programmer,comp.os.msdos.programmer,comp.lang.c
Subject: Re: calling batch file from C prog
Date: 2 Aug 1995 20:48:28 -0500
Organization: Informatics
Message-ID: <plAIw0zpkHXT084yn@merlin.magic.mb.ca>
References: <D93H3A.tv@bashful.demon.co.uk> <3q0107$j4p@news.iag.net>
 <etznlG0d8L2I075yn@goofy.iaccess.za> <DCM7sz.EA1@icis.on.ca>
Reply-To: wrightd@merlin.magic.mb.ca
NNTP-Posting-Host: merlin.magic.mb.ca
X-Newsreader: Yarn 0.84 with YES 0.20.B0509