Autostart Cygwin on Windows boot and run a cygwin command

Jeremy Bopp jeremy@bopp.net
Mon Mar 14 20:09:00 GMT 2011


On 3/14/2011 14:21, PeterSmith wrote:
> Ok, so for now lets focus on the contents of the .bat file. I'll have a look
> at the startup of the bat later :)

Excellent idea, especially considering that it's not really a Cygwin
problem at that point. ;-)

> I now have this:
> @echo off
> C:
> chdir C:\cygwin\bin
> bash -c "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 that still gives me the exact same error:
> C:\>start_cygwin.bat
> bash: line 0: cd:
> /cygdrive/e/solr/apache-solr-4.0-2010-10-12_08-05-48/example/: No such file
> or dir
> ectory
> Unable to access jarfile start.jar
> C:\cygwin\bin>

I think the "Unable to access..." error message is actually coming from
java.exe.  That's likely because the cd before the java call failed
first, so you're not in the directory you expect to be when java is
started.  Make sure you don't have a typo in that path to which you're
trying to cd.

You may also consider replacing the ; in the command with && so that the
java command is never run if the cd fails.

-Jeremy

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list