Optimizations related to Performance
Posted: 18 May 2011 14:44
I am trying to make my batch faster, It takes 2days, 6hours on a PIV 2000g 500MB laptop
So I discovered a technique that that enables a script to execute functions without having to jump to this function using call nor goto. This proved to be fast, no that's a joke REALLY FAST
I started using for tokens to detemine the functions parameters, do something with it (SIMPLE things like get filename and store the variable )
Then I introducent the concept of Objects
The idea is that I request an Object to be created let's say Object.HOST
I wan't this object to be a Extension so one of the tokens will be Extension the token is called Object.Extension.
Based upon Object.Extension I try to call a macro that returns me the Object.Extension
It is expected that I can create any kind of Object that way Object.Drive Object.RegAdd etc..
by the way these are some other macros, they are already debugged and fully operation, ow yes you need to delete %err.set.this% "" and some other variables:
In the end I would like to be able to call a lot of functions this way, I think setlocal ena is the only thing you need to test these macros, I am tired and well, they are much faster than any goto :label ()
This is a lot of code, paste it in notepad because the forum could use improvement |code]|/code]
Arrowbar suggested on code view
So I discovered a technique that that enables a script to execute functions without having to jump to this function using call nor goto. This proved to be fast, no that's a joke REALLY FAST
Code: Select all
SpeedOfMacro = SpeedOfFuncting / [b]REALLY[/b]
:function
goto eof
I started using for tokens to detemine the functions parameters, do something with it (SIMPLE things like get filename and store the variable )
Then I introducent the concept of Objects
The idea is that I request an Object to be created let's say Object.HOST
I wan't this object to be a Extension so one of the tokens will be Extension the token is called Object.Extension.
Based upon Object.Extension I try to call a macro that returns me the Object.Extension
It is expected that I can create any kind of Object that way Object.Drive Object.RegAdd etc..
Code: Select all
echo.
echo.
echo.FullPath.LocalHost.SCRIPT=!FullPath.LocalHost.SCRIPT!_
echo.
::
echo.Post.define: 'Create.Object' [OK]
for %%? in ( Create.Object ) do set "%%~?=set "Object.Name=%%~b" &set "Object.Extension=%%~c" &set "Object.Data=%%~d" &set "Error.Binary=%%~e" &echo. &echo.Object.Name:^^^!Object.Name^^^!_ &echo.Object.Extension:^^^!Object.Extension^^^!_ &echo.Object.Data:^^^!Object.Data^^^!_ &echo.Error.Binary:^^^!Error.Binary^^^!_ &echo. &echo.call Create.^^^!Object.Extension^^^!"
echo.Pre.define: 'Create.Object' [OK]
echo.
::for /f "usebackq tokens=1-4 delims=¦" %%b in ( '"Object.Name" ¦"Object.Extension" ¦"Object.Data" ¦"Error.Binary"' ) do %Create.Object% %(>nul)%
for /f "usebackq tokens=1-4 delims=¦" %%b in ( '"Host"¦"FileName"¦"!FullPath.LocalHost.SCRIPT!"¦"1"' ) do %Create.Object% %(>nul)%
echo.endoftest
pause
exit
::testin
set "%%~?=
set "Object.Name=%%~b"
&set "Object.Extension=%%~c"
&set "Object.Data=%%~d"
&set "Error.Binary=%%~e"
&echo.
&echo.Object.Name:^^^!Object.Name^^^!_
&echo.Object.Extension:^^^!Object.Extension^^^!_
&echo.Object.Data:^^^!Object.Data^^^!_
&echo.Error.Binary:^^^!Error.Binary^^^!_
&echo.
&echo.call Create.^^^!Object.Extension^^^!
"
by the way these are some other macros, they are already debugged and fully operation, ow yes you need to delete %err.set.this% "" and some other variables:
Code: Select all
::for /f "usebackq tokens=1-3 delims=¦" %%b in ( '"FullPathKeySTR"¦"KeyNameSTR"¦"StoreVAR"' ) do %ERR.Get.RegRead.TokenSTR% %(>nul)%
::for /f "usebackq tokens=1-3 delims=¦" %%b in ( '"FullPathKeyVAR"¦"KeyNameVAR"¦"StoreVAR"' ) do %ERR.Get.RegRead.TokenVAR% %(>nul)%
::for /f "usebackq tokens=1-3 delims=¦" %%b in ( '"FullPathKeySTR"¦"KeyNameSTR"¦"StoreVAR"' ) do %ERR.Chk_empty.RegRead.TokenSTR% %(>nul)%
::for /f "usebackq tokens=1-3 delims=¦" %%b in ( '"FullPathKeyVAR"¦"KeyNameVAR"¦"StoreVAR"' ) do %ERR.Chk_empty.RegRead.TokenVAR% %(>nul)%
::for /f "usebackq tokens=1-3 delims=¦" %%b in ( '"FullPathKeySTR"¦"KeyNameSTR"¦"StoreVAR"' ) do %ERR.Chk_exist.RegRead.TokenSTR% %(>nul)%
::for /f "usebackq tokens=1-3 delims=¦" %%b in ( '"FullPathKeyVAR"¦"KeyNameVAR"¦"StoreVAR"' ) do %ERR.Chk_exist.RegRead.TokenVAR% %(>nul)%
::for /f "usebackq tokens=1-3 delims=¦" %%b in ( '"FullPathKeySTR"¦"KeyNameSTR"¦"StoreVAR"' ) do %ERR.Chk_deep.RegRead.TokenSTR% %(>nul)%
::for /f "usebackq tokens=1-3 delims=¦" %%b in ( '"FullPathKeyVAR"¦"KeyNameVAR"¦"StoreVAR"' ) do %ERR.Chk_deep.RegRead.TokenVAR% %(>nul)%
::
for %%? in ( ERR.Get.RegRead.TokenSTR ) do set "%%~?=set "FullPathKey=%%~b" ^&set "KeyName=%%~c" ^&^>nul 2^>^&1 reg query "^^^!FullPathKey^^^!" /v "^^^!KeyName^^^!" ^&^&set /a ERR = 0 ^|^|set /a ERR = 1 ^&( if ^^^!ERR^^^! equ 0 for /f "skip=4 tokens=3* delims= " %%§ in ( '2^^^>nul reg query "^^^!FullPathKey^^^!" /v "^^^!KeyName^^^!"' ) do set "Content=%%§" ^&set "%%~d=^^^!Content^^^!" ) ^&( echo. ^&echo. ^&echo. RegRead : '%%~d' ^&echo. FullPathKey: '^^^!FullPathKey^^^!' ^&echo. KeyName : '^^^!KeyName^^^!' ^&set /p "?= Content : '^^^!Content^^^!'" ^<nul ^&if ^^^!ERR^^^! neq 0 ( set /p "?= [ERROR:^^^!ERR^^^!]" ^<nul ) else set /p "?= [OK]" ^<nul ) "
for %%? in ( ERR.Get.RegRead.TokenVAR ) do set "%%~?=set "FullPathKey=^^^!%%~b^^^!" ^&set "KeyName=^^^!%%~c^^^!" ^&^>nul 2^>^&1 reg query "^^^!FullPathKey^^^!" /v "^^^!KeyName^^^!" ^&^&set /a ERR = 0 ^|^|set /a ERR = 1 ^&( if ^^^!ERR^^^! equ 0 for /f "skip=4 tokens=3* delims= " %%§ in ( '2^^^>nul reg query "^^^!FullPathKey^^^!" /v "^^^!KeyName^^^!"' ) do set "Content=%%§" ^&set "%%~d=^^^!Content^^^!" ) ^&( echo. ^&echo. ^&echo. RegRead : '%%~d' ^&echo. FullPathKey: '^^^!FullPathKey^^^!' ^&echo. KeyName : '^^^!KeyName^^^!' ^&set /p "?= Content : '^^^!Content^^^!'" ^<nul ^&if ^^^!ERR^^^! neq 0 ( set /p "?= [ERROR:^^^!ERR^^^!]" ^<nul ) else set /p "?= [OK]" ^<nul ) "
for %%? in ( ERR.Chk_empty.RegRead.TokenSTR ) do set "%%~?=set "FullPathKey=%%~b" ^&set "KeyName=%%~c" ^&^>nul 2^>^&1 reg query "^^^!FullPathKey^^^!" /v "^^^!KeyName^^^!" ^&^&set /a ERR = 0 ^|^|set /a ERR = 1 ^&( if ^^^!ERR^^^! equ 0 for /f "skip=4 tokens=3* delims= " %%§ in ( '2^^^>nul reg query "^^^!FullPathKey^^^!" /v "^^^!KeyName^^^!"' ) do set "Content=%%§" ^&set "%%~d=^^^!Content^^^!" ^&for %%^^^! in ( "%%~d" ) do !ERR.Chk.IsDefined.TokenSTR! %()% ^>nul ) ^&( echo. ^&echo. ^&echo. RegRead : '%%~d' ^&echo. FullPathKey: '^^^!FullPathKey^^^!' ^&echo. KeyName : '^^^!KeyName^^^!' ^&set /p "?= Content : '^^^!Content^^^!'" ^<nul ^&if ^^^!ERR^^^! neq 0 ( set /p "?= [ERROR:^^^!ERR^^^!]" ^<nul ) else set /p "?= [OK]" ^<nul ) "
for %%? in ( ERR.Chk_empty.RegRead.TokenVAR ) do set "%%~?=set "FullPathKey=^^^!%%~b^^^!" ^&set "KeyName=^^^!%%~c^^^!" ^&^>nul 2^>^&1 reg query "^^^!FullPathKey^^^!" /v "^^^!KeyName^^^!" ^&^&set /a ERR = 0 ^|^|set /a ERR = 1 ^&( if ^^^!ERR^^^! equ 0 for /f "skip=4 tokens=3* delims= " %%§ in ( '2^^^>nul reg query "^^^!FullPathKey^^^!" /v "^^^!KeyName^^^!"' ) do set "Content=%%§" ^&set "%%~d=^^^!Content^^^!" ^&for %%^^^! in ( "%%~d" ) do !ERR.Chk.IsDefined.TokenSTR! %()% ^>nul ) ^&( echo. ^&echo. ^&echo. RegRead : '%%~d' ^&echo. FullPathKey: '^^^!FullPathKey^^^!' ^&echo. KeyName : '^^^!KeyName^^^!' ^&set /p "?= Content : '^^^!Content^^^!'" ^<nul ^&if ^^^!ERR^^^! neq 0 ( set /p "?= [ERROR:^^^!ERR^^^!]" ^<nul ) else set /p "?= [OK]" ^<nul ) "
for %%? in ( ERR.Chk_exist.RegRead.TokenSTR ) do set "%%~?=set "FullPathKey=%%~b" ^&set "KeyName=%%~c" ^&^>nul 2^>^&1 reg query "^^^!FullPathKey^^^!" /v "^^^!KeyName^^^!" ^&^&set /a ERR = 0 ^|^|set /a ERR = 1 ^&( if ^^^!ERR^^^! neq 0 ( %ERR.Set.THIS% "Reg query '^^^!FullPathKey^^^!' /v '^^^!KeyName^^^!'" ) else for /f "skip=4 tokens=3* delims= " %%§ in ( '2^^^>nul reg query "^^^!FullPathKey^^^!" /v "^^^!KeyName^^^!"' ) do set "Content=%%§" ^&set "%%~d=^^^!Content^^^!" ) ^&( echo. ^&echo. ^&echo. RegRead : '%%~d' ^&echo. FullPathKey: '^^^!FullPathKey^^^!' ^&echo. KeyName : '^^^!KeyName^^^!' ^&set /p "?= Content : '^^^!Content^^^!'" ^<nul ^&if ^^^!ERR^^^! neq 0 ( set /p "?= [ERROR:^^^!ERR^^^!]" ^<nul ) else set /p "?= [OK]" ^<nul ) "
for %%? in ( ERR.Chk_exist.RegRead.TokenVAR ) do set "%%~?=set "FullPathKey=^^^!%%~b^^^!" ^&set "KeyName=^^^!%%~c^^^!" ^&^>nul 2^>^&1 reg query "^^^!FullPathKey^^^!" /v "^^^!KeyName^^^!" ^&^&set /a ERR = 0 ^|^|set /a ERR = 1 ^&( if ^^^!ERR^^^! neq 0 ( %ERR.Set.THIS% "Reg query '^^^!FullPathKey^^^!' /v '^^^!KeyName^^^!'" ) else for /f "skip=4 tokens=3* delims= " %%§ in ( '2^^^>nul reg query "^^^!FullPathKey^^^!" /v "^^^!KeyName^^^!"' ) do set "Content=%%§" ^&set "%%~d=^^^!Content^^^!" ) ^&( echo. ^&echo. ^&echo. RegRead : '%%~d' ^&echo. FullPathKey: '^^^!FullPathKey^^^!' ^&echo. KeyName : '^^^!KeyName^^^!' ^&set /p "?= Content : '^^^!Content^^^!'" ^<nul ^&if ^^^!ERR^^^! neq 0 ( set /p "?= [ERROR:^^^!ERR^^^!]" ^<nul ) else set /p "?= [OK]" ^<nul ) "
for %%? in ( ERR.Chk_deep.RegRead.TokenSTR ) do set "%%~?=set "FullPathKey=%%~b" ^&set "KeyName=%%~c" ^&^>nul 2^>^&1 reg query "^^^!FullPathKey^^^!" /v "^^^!KeyName^^^!" ^&^&set /a ERR = 0 ^|^|set /a ERR = 1 ^&( if ^^^!ERR^^^! neq 0 ( %ERR.Set.THIS% "Reg query '^^^!FullPathKey^^^!' /v '^^^!KeyName^^^!'" ) else for /f "skip=4 tokens=3* delims= " %%§ in ( '2^^^>nul reg query "^^^!FullPathKey^^^!" /v "^^^!KeyName^^^!"' ) do set "Content=%%§" ^&set "%%~d=^^^!Content^^^!" ^&for %%^^^! in ( "%%~d" ) do !ERR.Chk.IsDefined.TokenSTR! %()% ^>nul ) ^&( echo. ^&echo. ^&echo. RegRead : '%%~d' ^&echo. FullPathKey: '^^^!FullPathKey^^^!' ^&echo. KeyName : '^^^!KeyName^^^!' ^&set /p "?= Content : '^^^!Content^^^!'" ^<nul ^&if ^^^!ERR^^^! neq 0 ( set /p "?= [ERROR:^^^!ERR^^^!]" ^<nul ) else set /p "?= [OK]" ^<nul ) "
for %%? in ( ERR.Chk_deep.RegRead.TokenVAR ) do set "%%~?=set "FullPathKey=^^^!%%~b^^^!" ^&set "KeyName=^^^!%%~c^^^!" ^&^>nul 2^>^&1 reg query "^^^!FullPathKey^^^!" /v "^^^!KeyName^^^!" ^&^&set /a ERR = 0 ^|^|set /a ERR = 1 ^&( if ^^^!ERR^^^! neq 0 ( %ERR.Set.THIS% "Reg query '^^^!FullPathKey^^^!' /v '^^^!KeyName^^^!'" ) else for /f "skip=4 tokens=3* delims= " %%§ in ( '2^^^>nul reg query "^^^!FullPathKey^^^!" /v "^^^!KeyName^^^!"' ) do set "Content=%%§" ^&set "%%~d=^^^!Content^^^!" ^&for %%^^^! in ( "%%~d" ) do !ERR.Chk.IsDefined.TokenSTR! %()% ^>nul ) ^&( echo. ^&echo. ^&echo. RegRead : '%%~d' ^&echo. FullPathKey: '^^^!FullPathKey^^^!' ^&echo. KeyName : '^^^!KeyName^^^!' ^&set /p "?= Content : '^^^!Content^^^!'" ^<nul ^&if ^^^!ERR^^^! neq 0 ( set /p "?= [ERROR:^^^!ERR^^^!]" ^<nul ) else set /p "?= [OK]" ^<nul ) "
::for /f "usebackq tokens=1-4 delims=¦" %%b in ( '"FullPathKeySTR"¦"KeyNameSTR"¦"RegTypeSTR"¦"ContentSTR"' ) do %ERR.Get.RegWrite.TokenSTR% %(>nul)%
::for /f "usebackq tokens=1-4 delims=¦" %%b in ( '"FullPathKeyVAR"¦"KeyNameVAR"¦"RegTypeVAR"¦"ContentSTR"' ) do %ERR.Get.RegWrite.TokenVAR% %(>nul)%
::for /f "usebackq tokens=1-4 delims=¦" %%b in ( '"FullPathKeySTR"¦"KeyNameSTR"¦"RegTypeSTR"¦"ContentSTR"' ) do %ERR.Chk.RegWrite.TokenSTR% %(>nul)%
::for /f "usebackq tokens=1-4 delims=¦" %%b in ( '"FullPathKeyVAR"¦"KeyNameVAR"¦"RegTypeVAR"¦"ContentSTR"' ) do %ERR.Chk.RegWrite.TokenVAR% %(>nul)%
::
for %%? in ( ERR.Get.RegWrite.TokenSTR ) do set "%%~?=set "FullPathKey=%%~b" ^&set "KeyName=%%~c" ^&set "RegType=%%~d" ^&set "Content=%%~e" ^&( if defined Content set "Content=^^^!Content:""=\"^^^!^^^" ) ^&^>nul reg add "^!FullPathKey^!" /v "^!KeyName^!" /t ^^^!RegType^^^! /f /d "^!Content^!" ^&set /a ERR = ^^^!ErrorLevel^^^! ^&( echo. ^&echo. ^&echo. reg add: '^^^!FullPathKey^^^!' ^&echo. KeyName: '^^^!KeyName^^^!' RegType: '^^^!RegType^^^!' ^&set /p "?= Content: '^!Content^!'" ^<nul ^&if ^^^!ERR^^^! neq 0 ( set /p "?= [ERROR:^!ERR^!]" ^<nul ) else set /p "?= [OK]" ^<nul ) "
for %%? in ( ERR.Get.RegWrite.TokenVAR ) do set "%%~?=set "FullPathKey=^^^!%%~b^^^!" ^&set "KeyName=^^^!%%~c^^^!" ^&set "RegType=^^^!%%~d^^^!" ^&set "Content=%%~e" ^&( if defined Content set "Content=^^^!Content:""=\"^^^!^^^" ) ^&^>nul reg add "^!FullPathKey^!" /v "^!KeyName^!" /t ^^^!RegType^^^! /f /d "^!Content^!" ^&set /a ERR = ^^^!ErrorLevel^^^! ^&( echo. ^&echo. ^&echo. reg add: '^^^!FullPathKey^^^!' ^&echo. KeyName: '^^^!KeyName^^^!' RegType: '^^^!RegType^^^!' ^&set /p "?= Content: '^!Content^!'" ^<nul ^&if ^^^!ERR^^^! neq 0 ( set /p "?= [ERROR:^!ERR^!]" ^<nul ) else set /p "?= [OK]" ^<nul ) "
for %%? in ( ERR.Chk.RegWrite.TokenSTR ) do set "%%~?=set "FullPathKey=%%~b" ^&set "KeyName=%%~c" ^&set "RegType=%%~d" ^&set "Content=%%~e" ^&( if defined Content set "Content=^^^!Content:""=\"^^^!^^^" ) ^&^>nul reg add "^!FullPathKey^!" /v "^!KeyName^!" /t ^^^!RegType^^^! /f /d "^!Content^!" ^&set /a ERR = ^^^!ErrorLevel^^^! ^&( if ^^^!ERR^^^! neq 0 %ERR.Set.THIS% "reg add '^!FullPathKey^!' /v '^!KeyName^!' /t '^!RegType^!' /d '^!Content^!'" ) ^&( echo. ^&echo. ^&echo. reg add: '^^^!FullPathKey^^^!' ^&echo. KeyName: '^^^!KeyName^^^!' RegType: '^^^!RegType^^^!' ^&set /p "?= Content: '^!Content^!'" ^<nul ^& set /p "?= [OK]" ^<nul ) "
for %%? in ( ERR.Chk.RegWrite.TokenVAR ) do set "%%~?=set "FullPathKey=^^^!%%~b^^^!" ^&set "KeyName=^^^!%%~c^^^!" ^&set "RegType=^^^!%%~d^^^!" ^&set "Content=%%~e" ^&( if defined Content set "Content=^^^!Content:""=\"^^^!^^^" ) ^&^>nul reg add "^!FullPathKey^!" /v "^!KeyName^!" /t ^^^!RegType^^^! /f /d "^!Content^!" ^&set /a ERR = ^^^!ErrorLevel^^^! ^&( if ^^^!ERR^^^! neq 0 %ERR.Set.THIS% "reg add '^!FullPathKey^!' /v '^!KeyName^!' /t '^!RegType^!' /d '^!Content^!'" ) ^&( echo. ^&echo. ^&echo. reg add: '^^^!FullPathKey^^^!' ^&echo. KeyName: '^^^!KeyName^^^!' RegType: '^^^!RegType^^^!' ^&set /p "?= Content: '^!Content^!'" ^<nul ^& set /p "?= [OK]" ^<nul ) "
::for /f "usebackq tokens=1-2 delims=¦" %%b in ( '"FullPathKeySTR"¦"KeyNameSTR"' ) do %ERR.Get.RegDelete.TokenSTR% %(>nul)%
::for /f "usebackq tokens=1-2 delims=¦" %%b in ( '"FullPathKeyVAR"¦"KeyNameVAR"' ) do %ERR.Get.RegDelete.TokenVAR% %(>nul)%
::for /f "usebackq tokens=1-2 delims=¦" %%b in ( '"FullPathKeySTR"¦"KeyNameSTR"' ) do %ERR.Chk.RegDelete.TokenSTR% %(>nul)%
::for /f "usebackq tokens=1-2 delims=¦" %%b in ( '"FullPathKeyVAR"¦"KeyNameVAR"' ) do %ERR.Chk.RegDelete.TokenVAR% %(>nul)%
::
for %%? in ( ERR.Get.RegDelete.TokenSTR ) do set "%%~?=set "FullPathKey=%%~b" ^&set "KeyName=%%~c" ^&( if defined KeyName set "KeyName=/v "^^^!KeyName^^^!"" ) ^&^>nul 2^>^&1 reg query "^^^!FullPathKey^^^!" ^^^!KeyName^^^! ^&^&set /a ERR = 1 ^|^|set /a ERR = 0 ^&( if ^^^!ERR^^^! neq 0 ^>nul reg delete "^^^!FullPathKey^^^!" ^^^!KeyName^^^! /f ^&set /a ERR = ^^^!ErrorLevel^^^! ) ^&( echo. ^&echo. ^&echo. reg delete: '^^^!FullPathKey^^^!' ^&set /p "?= KeyName : '^^^!KeyName^^^!'" ^<nul ^&if ^^^!ERR^^^! neq 0 ( set /p "?= [ERROR:^^^!ERR^^^!]" ^<nul ) else set /p "?= [OK]" ^<nul ) "
for %%? in ( ERR.Get.RegDelete.TokenVAR ) do set "%%~?=set "FullPathKey=^^^!%%~b^^^!" ^&set "KeyName=^^^!%%~c^^^!" ^&( if defined KeyName set "KeyName=/v "^^^!KeyName^^^!"" ) ^&^>nul 2^>^&1 reg query "^^^!FullPathKey^^^!" ^^^!KeyName^^^! ^&^&set /a ERR = 1 ^|^|set /a ERR = 0 ^&( if ^^^!ERR^^^! neq 0 ^>nul reg delete "^^^!FullPathKey^^^!" ^^^!KeyName^^^! /f ^&set /a ERR = ^^^!ErrorLevel^^^! ) ^&( echo. ^&echo. ^&echo. reg delete: '^^^!FullPathKey^^^!' ^&set /p "?= KeyName : '^^^!KeyName^^^!'" ^<nul ^&if ^^^!ERR^^^! neq 0 ( set /p "?= [ERROR:^^^!ERR^^^!]" ^<nul ) else set /p "?= [OK]" ^<nul ) "
for %%? in ( ERR.Chk.RegDelete.TokenSTR ) do set "%%~?=set "FullPathKey=%%~b" ^&set "KeyName=%%~c" ^&( if defined KeyName set "KeyName=/v "^^^!KeyName^^^!"" ) ^&^>nul 2^>^&1 reg query "^^^!FullPathKey^^^!" ^^^!KeyName^^^! ^&^&set /a ERR = 1 ^|^|set /a ERR = 0 ^&( if ^^^!ERR^^^! neq 0 ^>nul reg delete "^^^!FullPathKey^^^!" ^^^!KeyName^^^! /f ^&set /a ERR = ^^^!ErrorLevel^^^! ) ^&( if ^^^!ERR^^^! neq 0 %ERR.Set.THIS% "reg delete '^^^!FullPathKey^^^!' '^^^!KeyName^^^!'" ) ^&( echo. ^&echo. ^&echo. reg delete: '^^^!FullPathKey^^^!' ^&set /p "?= KeyName : '^^^!KeyName^^^!'" ^<nul ^& set /p "?= [OK]" ^<nul ) "
for %%? in ( ERR.Chk.RegDelete.TokenVAR ) do set "%%~?=set "FullPathKey=^^^!%%~b^^^!" ^&set "KeyName=^^^!%%~c^^^!" ^&( if defined KeyName set "KeyName=/v "^^^!KeyName^^^!"" ) ^&^>nul 2^>^&1 reg query "^^^!FullPathKey^^^!" ^^^!KeyName^^^! ^&^&set /a ERR = 1 ^|^|set /a ERR = 0 ^&( if ^^^!ERR^^^! neq 0 ^>nul reg delete "^^^!FullPathKey^^^!" ^^^!KeyName^^^! /f ^&set /a ERR = ^^^!ErrorLevel^^^! ) ^&( if ^^^!ERR^^^! neq 0 %ERR.Set.THIS% "reg delete '^^^!FullPathKey^^^!' '^^^!KeyName^^^!'" ) ^&( echo. ^&echo. ^&echo. reg delete: '^^^!FullPathKey^^^!' ^&set /p "?= KeyName : '^^^!KeyName^^^!'" ^<nul ^& set /p "?= [OK]" ^<nul ) "
In the end I would like to be able to call a lot of functions this way, I think setlocal ena is the only thing you need to test these macros, I am tired and well, they are much faster than any goto :label ()
This is a lot of code, paste it in notepad because the forum could use improvement |code]|/code]
Arrowbar suggested on code view