I have a script that opens 2 git-bash terminals, but I also want to run 2 commands inside that script. Type of the file is .bat
cd "C:\Program Files\Git"
start git-bash.exe "--cd=C:\Homestead"
start git-bash.exe "--cd=C:\Users\user\Projects\first"
exit
I need a vagrant up and for the second one I need npm run watch. I tried to use echo but nothing happend.
I am creating a script and I need to run exe file and a command at the same time. What am I doing wrong?
CD C:\Program Files (x86)\Jenkins\
START cmd.exe /T /C "jenkins.exe start"
The command line needs to be exactly as the following, otherwise it does not work:
C:\Program Files (x86)\Jenkins>jenkins.exe start
Thanks!
I don't quiet understand what you mean by saying you wan't to run an exe and a command at the same time. But if you wan't to start the jenkins.exe from your batch file, you can achieve this as follows:
cd "C:\Program Files (x86)\Jenkins\"
jenkins.exe start
alternatively, if you don't want the terminal to stay open as long as jenkins is running, you can use the following:
cd "C:\Program Files (x86)\Jenkins\"
start jenkins.exe start
I have a NodeJS server that I run using npm startand an AngularJS client UI application that I also run using npm start, is there a way to create a desktop shortcut to run the command lines with just a click?
As mentioned in my comment, a batch script seems like the easiest way of doing this. If you're on Windows, this should do what you need:
start cmd /k "cd C:/yournodeproject && npm start"
start cmd /k "cd C:/yourangularproject && npm start"
start runs a command in a new window.
cmd /k allows us to pass a string into the new command line.
Each window switches to the relevant directory and runs npm start.
Unfortunately I don't know enough about Bash to offer a Linux equivalent, but hopefully this will get you started.
I would like to write a bat script that runs simultaneously Unity, visual studio and git shell. I would like to make git shell change directory (it always start at default github's repositories location), but I can't figure how.
so far, I've got something like that:
echo off
d:
cd D:\<path>\Visual Studio\Common7\IDE
start .\devenv.exe "C:\<path>\solution.sln"
cd D:\<path>\Unity\Editor
start .\Unity.exe -projectPath "C:\<path>\project directory"
c:
cd C:\Users\<username>\AppData\Local\GitHub\
start .\GitHub.appref-ms --open-shell //and now i need to execute "cd ../my project" on it
I need to figure out this seemingly very simple issue on windows .bat file. I have been using Linux for past 10 years full-time, so I am in pretty unfamiliar territory when it comes to .bat scripts.
We have some units tests that need to run on from this .bat file, and a build needs to be generated after the tests have run.
The bat file itself is very simple, I was thinking of just chaining the commands:
cls
echo "Running test suite - CRMSync"
echo
echo
REM from command: --static-backup
phpunit --bootstrap test/bootstrap_test.php --verbose --log-junit
echo "Running phploc for CRMSync"
phploc --count-tests --verbose > C:\CRMsync\testResults\phploc\index.html
echo "Executing phing"
phing
Now, simple enough except nothing is executed past phpunit command. How do I deal with this?
The unit tests run fine, but I am suspecting it could even be in the unit test lib that process is killed. Is there a way to fork the process somehow or get the other commands below to run?
Thanks SO'ers, as always, any help greatly appreciated.
I had the same problem for a development script that I made. And I tried all given solutions without being successful. At the end, I did it with cmd /C.
From the windows docs it will:
Run Command and then terminate
So for example, you can use it as follows:
cls
echo "Running test suite - CRMSync"
echo
echo
REM from command: --static-backup
cmd /C phpunit --bootstrap test/bootstrap_test.php --verbose --log-junit
echo "Running phploc for CRMSync"
cmd /C phploc --count-tests --verbose > C:\CRMsync\testResults\phploc\index.html
echo "Executing phing"
cmd /C phing
I hope you find this useful.
Similar to the post ujifgc, I use "start /b ..." in these situations. If you encapsulate the call to phpunit in another batch file, you can use "call".
Is phpunit itself a batch file (I don't do much PHP, so am not familiar with the tool)? If so, try using:
call phpunit --bootstrap test/bootstrap_test.php --verbose --log-junit
Try start /WAIT phpunit ... to fork process and wait for it or just start phpunit ... to fork and continue. Help is here: start /?
I used
start /b code .
cmd /k ng serve --build-optimizer --aot
to start Visual Studio Code and then a node js server.
But the Command line glitched with the % update text and more.
I then used
cmd /C code .
cmd /k ng serve --build-optimizer --aot
and the glitching stopped for the server progress update.