-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New Time funtionality and EvalBat_Debug.bat for help debugging
- Loading branch information
Showing
4 changed files
with
149 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
@echo off | ||
REM "EvalBat" is a helper that lets you evaluate (vbscript) expressions in a batch file | ||
REM "EvalBat" can be used to add floating point support and complex math support to batch files | ||
REM Copyright (c) 2020-2022 Adisak Pochanayon | ||
REM Contact: adisak@gmail.com | ||
REM See EvalBat_License.txt for details | ||
REM Currently hosted at https://github.com/adisak/EvalBat | ||
|
||
REM ----------------------------------- | ||
|
||
echo Input: %* | ||
call "%~dp0\EvalBat.bat" %* | ||
echo Result: %EVALBAT_RESULT% | ||
|
||
cscript.exe /nologo //X "%~dp0\EvalBat_vbs.vbs" "%*" |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
@echo off | ||
REM "EvalBat" is a helper that lets you evaluate (vbscript) expressions in a batch file | ||
REM Copyright (c) 2020-2023 Adisak Pochanayon | ||
REM Contact: adisak@gmail.com | ||
REM See EvalBat_License.txt for details | ||
REM Currently hosted at https://github.com/adisak/EvalBat | ||
|
||
REM ----------------------------------- | ||
|
||
REM TEST script to Time a command | ||
SETLOCAL | ||
SET PATH=%PATH%;..\scripts | ||
|
||
call :TestEBTimer | ||
|
||
ENDLOCAL | ||
goto:EOF | ||
|
||
REM ----------------------------------- | ||
REM Subroutines | ||
:BeginEBTimer | ||
call EvalBat.bat Now | ||
set %~1EBTimeBegin=%EVALBAT_RESULT% | ||
goto:EOF | ||
|
||
:EndEBTimer | ||
call EvalBat.bat Now | ||
set %~1EBTimeEnd=%EVALBAT_RESULT% | ||
goto:EOF | ||
|
||
:EvalEBTimer | ||
SETLOCAL EnableDelayedExpansion | ||
set TIMESTART=!%~1EBTimeBegin! | ||
if "%~2"=="" ( | ||
set TIMEEND=!%~1EBTimeEnd! | ||
) else ( | ||
set TIMEEND=!%~2EBTimeEnd! | ||
) | ||
ENDLOCAL & call EvalBat.bat DateDiff(''s'',cDate(''%TIMESTART%''),cDate(''%TIMEEND%'')) | ||
SETLOCAL | ||
echo %EVALBAT_RESULT% seconds | ||
call EvalBat.bat %EVALBAT_RESULT%/60 | ||
echo %EVALBAT_RESULT% minutes | ||
ENDLOCAL | ||
goto:EOF | ||
|
||
REM ----------------------------------- | ||
|
||
:TestEBTimer | ||
SETLOCAL | ||
|
||
echo Time (10 seconds) | ||
|
||
call :BeginEBTimer | ||
timeout /T 10 /NOBREAK >NUL | ||
call :EndEBTimer | ||
call :EvalEBTimer | ||
|
||
echo Time {T1} (5 seconds) | ||
|
||
call :BeginEBTimer T1 | ||
timeout /T 5 /NOBREAK >NUL | ||
call :EndEBTimer T1 | ||
call :EvalEBTimer T1 | ||
|
||
echo Total Time | ||
call :EvalEBTimer "" T1 | ||
|
||
ENDLOCAL | ||
goto:EOF | ||
|
||
REM ----------------------------------- |