Thread View: borland.public.cppbuilder.nativeapi
3 messages
3 total messages
Started by Matt Barnes
Mon, 20 Mar 2006 19:51
Executing Windows Command Line commands from Borland.
Author: Matt Barnes
Date: Mon, 20 Mar 2006 19:51
Date: Mon, 20 Mar 2006 19:51
6 lines
1224 bytes
1224 bytes
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.
Author: Ed Mulroy
Date: Mon, 20 Mar 2006 21:57
Date: Mon, 20 Mar 2006 21:57
26 lines
2132 bytes
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.
Re: Executing Windows Command Line commands from Borland.
Author: Remy Lebeau (TeamB)
Date: Mon, 20 Mar 2006 23:15
Date: Mon, 20 Mar 2006 23:15
10 lines
1086 bytes
1086 bytes
"Matt Barnes" <barnesm@lexmark.com> wrote in message news:441f15cf$1@newsgroups.borland.com... > Is there a way to call these commands directly from Borland C++ Look at the WNetAddConnection...() functions in the Win32 API. Gambit
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads