Board index » cppbuilder » Executing Windows Command Line commands from Borland.

Executing Windows Command Line commands from Borland.


2006-03-21 03:51:27 AM
cppbuilder71
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.
-Matt
 
 

Re:Executing Windows Command Line commands from Borland.

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
Quote
Matt Barnes wrote in message
news:441f15cf$ XXXX@XXXXX.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.
 

Re:Executing Windows Command Line commands from Borland.

"Matt Barnes" < XXXX@XXXXX.COM >wrote in message
Quote
Is there a way to call these commands directly from Borland C++
Look at the WNetAddConnection...() functions in the Win32 API.
Gambit
 

{smallsort}