Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 为c编译批处理脚本#_C#_Batch File - Fatal编程技术网

C# 为c编译批处理脚本#

C# 为c编译批处理脚本#,c#,batch-file,C#,Batch File,我编写了下面的批处理脚本来编译cs代码,但它不起作用。有什么想法吗 @echo off %comspec% /k ""C:\Program Files\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"" x86 csc.exe -target:exe *.cs 它会打开vcvarsall.bat,但最后一行不起作用。使用/k意味着%comspec%将保留在内存中,直到您退出外壳。 使用/c,批处理文件应在其他批处理文件运行后继续 此

我编写了下面的批处理脚本来编译cs代码,但它不起作用。有什么想法吗

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

它会打开vcvarsall.bat,但最后一行不起作用。

使用
/k
意味着
%comspec%
将保留在内存中,直到您退出外壳。
使用
/c
,批处理文件应在其他批处理文件运行后继续

此外,您还可以使用
call
代替
%comspec%/c
使其工作:

1-将此路径添加到系统环境:

   C:\Windows\Microsoft.NET\Framework\v4.0.30319
2-将.bat文件更改为:

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

.

没有错误,但除了opennig vs命令提示符外,什么也没有发生!嗯。。。那不应该是
csc.exe
吗?该文件存在吗?(即,你能在it资源管理器中看到该文件夹)取出
@echo off
,然后再试一次-你会看到更多的输出。@Christian.K:天哪,我甚至没有发现:-)