Run cmd.exe with /c.

Linda Walsh cygwin@tlinx.org
Tue Mar 23 07:43:00 GMT 2010


Oleksandr Gavenko wrote:
> I want execute .bat file. I think easy way to do this is
> invoke $COMSPEC to do that. Like this
> 
>   $(subst \,/,$(COMSPEC)) /c file.bat
> 
> from Makefile.
> 
> But cmd fail with error:
> 
>   bash# cat 1.bat
> @echo off
> echo xxx
>   bash# cmd.exe /c 1.bat
> bash: /cygdrive/c/WINDOWS/system32/cmd.exe: Bad address
----
	This is weird.

I get it too:
/tmp> cmd.exe /c dir
bash: /Windows/system32/cmd.exe: Bad address

When /Windows/system32/cmd.exe WORKS!

ie. works:
/Windows/System32/cmd.exe /c dir

Also if you want to use comspec, use it with cygpath:

$(cygpath $COMSPEC) /c dir


--
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