🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #4133

Re: Executing Windows Command Line commands from Borland.

#4133
From: Ed Mulroy
Date: Mon, 20 Mar 2006 21:57
26 lines
2132 bytes
Batch files are scripts that are interpreted by theh command interpreter.

You could use the function system to execute the batch file.

You could get the command interpreter name from the environment variable 
COMSPED, append a space and then the batch file name.  Then use one of 
WinExec, CreateProcess or ShellExecute to execute the command.

By doing the above with CreateProcess you can get the handle of the process 
that was started.  You could then use that handle to determine when the task 
is done.

.  Ed

> Matt Barnes wrote in message
> news:441f15cf$1@newsgroups.borland.com...
>
> I am trying to execute some commands from that I can use in
> the command line of Windows in order to connect to a network
> drive and ask for a user name and password. I have a batch
> file with these commands in it (the "net use" command more
> specifically).
>
> Is there a way to call these commands directly from Borland C++
> or is there a way to call batch files within a program's execution.
> Any help would be greatly appreciated, thanks.
Technical Details
Message-ID: <441f258f@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news3.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <441f15cf$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,c70447e0965bc2c5
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Ed Mulroy" <dont_email_me@bitbuc.ket>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <441f15cf$1@newsgroups.borland.com>
Subject: Re: Executing Windows Command Line commands from Borland.
Date: Mon, 20 Mar 2006 16:57:07 -0500
Lines: 28
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 66.57.117.102
Message-ID: <441f258f@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1142891919 66.57.117.102 (20 Mar 2006 13:58:39 -0700)
X-Authenticated-User: edmulroy
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news3.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail