質問編集履歴
1
最終的なコードを追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -167,3 +167,51 @@
|
|
167
167
|
|
168
168
|
|
169
169
|
よろしくお願いします。
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
### まとめ(追記)
|
174
|
+
|
175
|
+
最終的なコードです。
|
176
|
+
|
177
|
+
```.bat
|
178
|
+
|
179
|
+
@echo off&title %~n0&setlocal enabledelayedexpansion&for /f "tokens=*" %%i in ('certutil -hashfile "%~f0"^|find /v":"') do (set app_hash=%%i)
|
180
|
+
|
181
|
+
set app_name=%~dp0%~n0[%app_hash%]&set src_path=!app_name!.cs
|
182
|
+
|
183
|
+
if not exist "%app_name%.exe" (del "%~dp0%~n0[*].*">nul 2>&1&type "%~f0"|more +5>"%src_path%"&for /f "tokens=*" %%i in ('where /r %windir%\Microsoft.NET csc.exe^|sort') do (set compiler_path=%%i)
|
184
|
+
|
185
|
+
"!compiler_path!" /nologo /out:"%app_name%.exe" "%src_path%")
|
186
|
+
|
187
|
+
"%app_name%.exe" %*&exit /b %errorlevel%
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
//! @file template.bat
|
192
|
+
|
193
|
+
//! @version 1.00r1
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
using System;
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
class Program
|
202
|
+
|
203
|
+
{
|
204
|
+
|
205
|
+
static void Main(string[] args)
|
206
|
+
|
207
|
+
{
|
208
|
+
|
209
|
+
Console.WriteLine("Hello C# !!");
|
210
|
+
|
211
|
+
Console.ReadKey();
|
212
|
+
|
213
|
+
}
|
214
|
+
|
215
|
+
}
|
216
|
+
|
217
|
+
```
|