Custom Build Process on Windows
I'm trying to write a custom build step that will copy a config file to the application's directory.
I have Enable custom process step checked
Name: Custom Process Step
Working Directory: $BUILDDIR
Command arguments PostBuild.bat
My .bat file is:
copy copy.xml $DESTDIR
echo Copied copy.xml
When I build the build process hangs with the output:
The process "C:/Qt/2010.04/mingw/bin/mingw32-make.exe" exited normally.
Starting: "C:/Windows/system32/cmd.exe" PostBuild.bat
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
It never exits. Does anyone know what I might be doing wrong?
Have you tried running the same thing from a command prompt? If you do, you will notice that exactly the same thing happens - a new command prompt is started and your .bat file is not used at all. The reason is that cmd simply does not work the way you think - to pass a .bat file you have to use the /c command line option. So changing the command arguments to /c PostBuild.bat should do what you want (if PostBuild.bat is placed where cmd expects to find it).
There is another problem:
you batch file will not work.
You should try out the batch file from a command propt to verify it's usage. $DESTDIR is a qMake and perhaps QtCreator variable, but none for a batch file. Inside batch files, you must use windows syntzax for variables: %VARNAME%
perhaps some of the following pages might help: