mefmef
mefmef

Reputation: 665

Compile batch script for c#

I wrote the batch script below to compile cs code, but it does not work. Any ideas?

   @echo off
   %comspec% /k ""C:\Program Files\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"" x86
   csc.exe -target:exe *.cs

It opens the vcvarsall.bat but the last line does not work.

Upvotes: 0

Views: 957

Answers (2)

mefmef
mefmef

Reputation: 665

To Make it works :

1- add this path to the system environments:

   C:\Windows\Microsoft.NET\Framework\v4.0.30319

2- change the .bat file to this:

   @echo off
   csc.exe -target:exe *.cs

.

Upvotes: 0

SeanC
SeanC

Reputation: 15923

using /k will mean the %comspec% will remain in memory, until you exit the shell.
use /c and the batch file should continue after the other batch file has been run.

Also, you can use call in the place of %comspec% /c

Upvotes: 1

Related Questions