How to run 'cfx xpi' after 'activate' via .bat? - batch-file

I'm trying to automatize installing of my addon. Mozilla says that it's very simple, but:
I didn't find any while loops in .bat files or sleep for milisec.
I can't understand, how to use activate.bat and cfx xpi in one CMD window sequentially, and also use wget in other CMD after all.
How can I do even if second part? I've tried something like:
START cmd /K "activate "cfx xpi"" && wget --post-file=tst-closing-cur-tab.xpi http://localhost:8888/
or
START cmd /K "activate && "cfx xpi"" && wget --post-file=tst-closing-cur-tab.xpi http://localhost:8888/
but it always run cfx in CMD, not in 'virtual CMD' after activate

I use this
call "c:\Firefox\Sdk\bin\activate.bat"
cd c:\dev-1.0.2.5-firefox\
cfx xpi

Related

Can't manage to make CMD launch a program using start

I made a .bat file which is supposed to run Thunderbird minimized.
Here's what I put in it so far:
start /min "" C:\"Program Files (x86)"\"Mozilla Thunderbird"\thunderbird.exe runas /user:Administrator
I tried several tests:
- Removing /min
- Adding the runas option for administrator rights
- Adding the first empty quotes after start
- Writing the whole path into quotes
- ...etc.
Everything that happens is the .bat launches, but nothing furthermore happens.
I have no error in the CMD window.
Why isn't it working ??
My purpose is to put that .bat in startup folder so that Thunderbird launches minimized on startup.
I used to use an extension (MinimizeOnStartup) for Thunderbird, but it's no longer compatible with latest version and I couldn't manage to find any alternative.
I read through here, it wasn't enough to help:
A batch file to minimize other applications
Can you help me?
Thank you.
Using Windows 10.
Try the following (modify it accordingly)
cd C:\Program Files (x86)\Mozilla Thunderbird\
start /min thunderbird.exe runas /user:Administrator
A solution posted on reddit https://www.reddit.com/r/Thunderbird/comments/bnt6u3/ive_created_a_small_script_to_minimize/ ...
This is Windows only. You'll need NirCMD for this. NirCMD will trigger the "Minimize" Event after we've started Thunderbird. Get it here: https://www.nirsoft.net/utils/nircmd.html
The script:
START "" "C:\Program Files\Mozilla Thunderbird\thunderbird.exe"
timeout /T 3 /nobreak
"nircmd.exe" win min process "thunderbird.exe"

How to use batch file to launch cmd silently?

I am trying to use my batch script to call upon a cmd to uninstall a program.
install -u
Is there a way which I can use my batch script to execute this cmd silently? Meaning it wont pop up.
Thanks!
start /min install -u
or if it's a command-line program
start /min cmd /c install -u

Running NodeJS server and Angular client server from a desktop shortcut

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.

Can I run git shell and execute command from cmd?

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

Have .bat file continue after it runs a command

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.

Resources