how does this batch script works? -


i got script site have problems how script works

the script

@setlocal enableextensions enabledelayedexpansion @echo off title movement color 0a  set length= set height=a  :controls cls echo use wasd move character ([]). echo. %%a in ( %height% ) echo. echo %length%[] choice /c wasd /n if %errorlevel% equ 1 call:up if %errorlevel% equ 2 call:left if %errorlevel% equ 3 call:down if %errorlevel% equ 4 call:right  :left set length=!length:~0,-1! goto controls  :right set length=%length% goto controls  :up set height=!height:~0,-2! goto controls  :down set height=%height% goto controls 

ok can explain first line? serached web , think give value variables when command reached

also dont know means set height=!height:~0,-2! , set length=!length:~0,-1!

for enabledelayedexpansion see this blog post. (in short makes variables work in sane fashion.)

enableextensions seems safety feature in case command extensions have been disabled (though appear on default). isn't clear me quick read (other newer command features).

edit: linked page @user3245060 mentions in hist comment cmd page indicates (at least some) commands affected enableextensions , indicates further details may available in commands specific pages. (it seem noodles has idea involved here.)

set height=!height:~0,-2! appears string processing (as per this link.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -