We help IT Professionals succeed at work.

need batch file for windows command prompt to open, copy a file start a program and then close

i need a batch file that i can run that will do the following

copy an   .ini file
copy an .exe file
run the .exe file
close the batch window, while leaving the program running.

what i have so far is

xcopy P:\suite\new\ca.exe "c:\program files\ca" /Y
xcopy P:\suite\new\ca.ini c:\ca.ini /Y

"c:\program files\ca\ca.exe"


this works fine except that it leaves the command window open until i exit the ca.exe program.

this is a problem because sometimes in moving in and out of forms within the program, teh command window ends up on top of the pile. and not consistantly.

so what i was hoping to do was to be able to start the program within the command window and then just exit the command window.  leaving the program running.

Watch Question


start "c:\program files\ca\ca.exe"

in your cmd-file.


i add the start.
i just get a command window.

i take the start back out   it executes the program and leaves the window open...

i have other programs that explicity use the /w command for the program to wait until the executed program is complete before continuing....

this is the oppisite of that.

i WANT it to continue on and end.
If you just get another command box instead of your program started with
start "C:\path\to\program.exe"

Open in new window

there is anything wrong with your exe. Is it a real exe/binary or something else like another script?
In batch using start is the prefered method to execute a binary exe-application.


ok,  it really doesnt like spaces.

i had to  do this

cd "c:\program files (x86)\ca"
start ca.exe

You have two options for the folder, if your exe-file contains spaces just first works:
rem Using old dos names (from "dir /X")
start C:\Progra~1\ca\ca.exe
rem Using /D for path
start /D"%ProgramFiles(x86)%\ca" ca.exe

Open in new window

Explore More ContentExplore courses, solutions, and other research materials related to this topic.