Sometimes my Windows server reboots at night to install new updates. Then the next day I find out that my cygwin instance has been stopped.
What I want is on Windows start, also run Cygwin AND run a specific command.
so, step 1:
Right now I have a cygwin.bat to start cygwin:
@echo off
C:
chdir C:\cygwin\bin
bash --login -i
step 2 is to enter the command in the command windows that appears after running cygwin.bat:
cd /cygdrive/e/solr/apache-solr-4.0-2010-10-12_08-05-48/example/;java -Dsolr.solr.home="./example-DIH/solr/" -jar start.jar
But this command is what I want to have called automatically when i run cygwin.bat
How can I combine step 1 and step 2 into a single bat file which I can run on Windows start?
Best Answer
You can create a new .bat file that runs on startup, and use the
bash -c
option to pass commands to bash when you start it. For example:You could also make the changes to your cygwin.bat, but then the commands would run every time you start a shell.