Skip to content

Instantly share code, notes, and snippets.

@orange-in-space
Created January 7, 2022 14:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save orange-in-space/d47db7a4daa06d7598ea3afdddd32ce3 to your computer and use it in GitHub Desktop.
Save orange-in-space/d47db7a4daa06d7598ea3afdddd32ce3 to your computer and use it in GitHub Desktop.
self compile .bat .cs combined file. Windowsバッチファイル 兼 C# ソースコードで、自分でcsc.exeを探してコンパイルできるやつ><
/*
@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