npocmaka/batch.scripts

Speedup optimisation for .net batch files

SergeAgeyev opened this issue · 2 comments

Absolutely great job!

Just one suggestion to speedup operation in .net bat files:
Add if exist "%~n0.exe" %~n0.exe %* just after begin of bath body, so it will not search for .net framework if to compile .net part if it is already compiled (if compiled .exe exists, it will run it immediately):

Was:

:batch
@echo off
setlocal

Faster:

:batch
@echo off
if exist "%~n0.exe" (
"%~n0.exe" %*
exit /b %errorlevel% 
)
setlocal

PS: Edited: Added exit after execution

Very good idea! When I have the time I'll update the .net hybrids.

I have provided more details and better solution in issue #25