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
Related
I am experiencing a strange issue with the following batch script run via cmd.exe on Windows:
#echo off
gradle wrapper
gradlew build
pause
This batch script only ever executes the first command, i.e. gradle wrapper. After that, the batch script automatically terminates and the command gradlew build is never executed.
Is there any way I can force the batch script so that it cannot be stopped by gradle wrapper and continues its execution normally after gradle wrapper has been called?
I have a feeling you may need to precede with call:
call gradle…
I am trying to run a batch file from Jenkins but I can't get it to run.
In the pre-build step I have entered the file I want to execute but I get the stacktrace shown below. Jenkins doesn't recognize the cmd command.
How can I fix this?
Your Linux Jenkins slave doesn't support cmd. In order to workaround it you have several options (from better to worse):
Add a Windows slave to Jenkins and run cmd from there.
Port your batch file to bash or similar and run it from your Linux Jenkins slave.
Add some kind of DOS emulator (Wine, DOSBox, DOSemu) in your Linux Jenkins slave.
My advice: If you know Linux & Bash or you have no control of Jenkins go for option 2. Otherwise go for option 1. Avoid option 3.
You're trying to run CMD on a LINUX machine. either change the slave you're running to Windows machine or migrate the Batch script to shell script.
Good luck!
I am trying to launch an Android emulator from a batch file inside my build definition, with the next command:
start /WAIT "Start Emulator" "C:\Program Files (x86)\Microsoft Emulator Manager\1.0\emulatorcmd.exe" launch /sku:Android /id:97522427-7A5E-4F3B-96A8-B9F9F0C0423A
I tried to add the build step as a command line, and a batch script.
Problem: The script is working right, and opening the emulator and wait for it to fully open, but once script finishes executing and console closes, the emulator is closing as well.
I tried to run the script directly on build server, and it works fine without closing emulator, but when queued as a build step, I am facing the above problem.
Question: How can I force the emulator to stay open after batch file finishes executing?
EDIT:
It looks like the build definition task terminates all processes it created in the defined step, I have tried multiple script, tried cmd /k and tried the /b and tried to create another batch file that actually calls this one or start it, yet no results. I am still waiting for any possible solution.
Alright, I tried a lot of scripts in batch files, and I tried to run it from command line, after a lot of time waste and getting tired, I decided to give PowerShell task a try to fix my problem. I ended up with this:
Start-Process -FilePath "C:\Program Files (x86)\Microsoft Emulator Manager\1.0\emulatorcmd.exe" -ArgumentList "launch /sku:Android /id:97522427-7A5E-4F3B-96A8-B9F9F0C0423A" -Verb runas
Start-Sleep -s 60
This made the emulator start, and stays running even after PowerShell script ends.
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!
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