Make Jenkins start a Batch without running forever? - batch-file

How would I go about making a Jenkins server start a .bat file, that runs forever as it starts a server program, without having Jenkins run forever until the bat file is ended manually or by error?
Could this be solved by making Jenkins call a bat file which calls the server bat file thar runs forever?

You need to detach execution from the main process, similar to the & operator in Linux.
If you bath file is named run-forever.bat, then create another batch file named forever-starter.bat that does this :
#start "" cmd /c run-forever.bat

Related

Starting a batch file from another batch file only opens CMD

When I start a batch file from another batch file, it just opens a new CMD window named just "TEST.bat", and doesn't run the actual batch. Running it manually works fine.
cd %~dp0\Colours\TEST.bat
start "TEST.bat"
I have tried many different ways to run the batch, but it all does the same thing. I've also tried to run the batch as administrator but same result again.
Full code(not finished): http://pastebin.com/GE8yJP0J
To run another batch file, use call not start. Also: cd expects a directory, not a filename.
cd "%~dp0\Colours"
call TEST.bat

Running an executable file via a .bat file in Windows Task Scheduler

I'm trying to run this .bat file via a job in Task Scheduler, for some reason the application isn't being run.
Is there something wrong with my syntax? I thought the problem could have been not specifying a window name. I've now added that and it still isn't executing. The code is below (names/ paths have been generalised):
ROBOCOPY C:\path\to\file\ Z:\ csvfile.csv /R:2000
START "" \\servername\serverdirectory\serverdirectory2\file.exe
When I run this .bat manually it runs correctly. Could it be down to permissions?
Thanks!

Nunit result xml is not updated during Jenkins build

I have configured NUnit tests to run after build completed.(Jenkins)
I added following on Excecute windows batch command window in Jenkins.
rmdir ClickOnceInstall /Q /S
mkdir ClickOnceInstall
CD BuildScripts
Start.bat
"C:\Program Files (x86)\NUnit 2.6.2\bin\nunit-console-x86.exe" AA.Tests\bin\x86\Release\AA.Tests.dll /xml=nunit-result.xml
It seems Execute unit test command doesn't create result file as specified name and marked as failed. However, when I run the nunit test command manually it creates the file. Next time build through Jenkins, result xml file does not seem to be updated but it doesn't fail.
am I missing any configuration or something else?
It would help if you would paste the console log.
However, my first guess is to ask you to add call to your batch file statement:
call Start.bat
If that batch file has an exit /b statement (even with 0), it will quit the whole calling step (i.e. "Execute windows batch command") without getting to your last statement (i.e nunit command).
Using call in front of the batch file will make sure that control is returned to the calling step.

How to run several batch files without open shell windows?

I've got some .bat files with start xxx and I need to run them all in another file
so if do start xxx.bat there I will get running xxx and command line shell. I don't need another shell so how to run batch file without opening another shell? or close it's shell after executing.
If I understand correctly, you just want to use call instead of start.
Example:
call xxx.bat

Hudson won't execute windows batch commands after running a .bat script

In hudson, after running a .bat script my slave refuses to run anything that comes afterward. It instead just said that it finished with a success.
Trying do a
call yourscript.bat
instead of just a
yourscript.bat

Resources