Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling a batch file invisibly 1

Status
Not open for further replies.

biot023

Programmer
Nov 8, 2001
403
GB
Hallo.
I'm currently coding an application that needs to retrieve files across a firewall from a Sun server, and, as always, need to do it on the cheap.
To this end, I have code that takes relevant parameters & creates a batch file & an ftp script to run in it.
The only trouble is, I don't know how to run a batch file from a builder app. (or any other app, for that matter...).
Anybody able to help?

Cheers,
Douglas. If it don't make you laugh, it ain't true.
 
Look at WinExec (faq101-1951), ShellExecute (faq101-1952), ShellExecuteEx (faq101-1953), or CreateProcess (faq101-1951). For example,
Code:
AnsiString = CommandIs = "C:\\MyBatFile.bat"; // The batch file
STARTUPINFO StartInfo; // name structure
PROCESS_INFORMATION ProcInfo; // name structure
memset(&ProcInfo, 0, sizeof(ProcInfo)); // Set up memory block
memset(&StartInfo, 0 , sizeof(StartInfo)); // Set up memory block
StartInfo.cb = sizeof(StartInfo); // Set structure size
StartInfo.dwFlags = STARTF_USESHOWWINDOW; // Necessary for wShowWindow to work
StartInfo.wShowWindow = SW_HIDE; // Hide window
bool Result = CreateProcess(NULL, CommandIs.c_str(), NULL, NULL, NULL, NULL, NULL, NULL, &StartInfo, &ProcInfo);
James P. Cottingham

I am the Unknown lead by the Unknowing.
I have done so much with so little
for so long that I am now qualified
to do anything with nothing.
 
Thanks alot - I'll be reading these in depth @ first opportunity.

Douglas. If it don't make you laugh, it ain't true.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top