Created
January 7, 2022 14:55
-
-
Save orange-in-space/d47db7a4daa06d7598ea3afdddd32ce3 to your computer and use it in GitHub Desktop.
self compile .bat .cs combined file. Windowsバッチファイル 兼 C# ソースコードで、自分でcsc.exeを探してコンパイルできるやつ><
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
@echo off | |
setlocal | |
for /f "usebackq delims=" %%A in (`dir /s /b %WINDIR%\Microsoft.NET\CSC.EXE`) do set CSCFULLPATH=%%A | |
echo csc fullpath is %CSCFULLPATH% | |
@echo on | |
%CSCFULLPATH% /platform:x64 /target:exe %~n0.bat | |
@if %errorlevel% equ 0 ( echo %~n0.exe was generated? maybe... ) | |
goto :eof | |
*/ | |
// cs part | |
using System; | |
namespace CombinedFileDemo | |
{ | |
class Program | |
{ | |
static void Main() | |
{ | |
Console.WriteLine("bat/cs Combined file demo. Press any key..."); | |
Console.ReadKey(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment