batch file - How to show a data list for created profiles -


i"m new batch file , i'm attempting make rpg i'm looking goes past knowledge of batch file wondering how make system able see profiles/users/data's created decide load,delete,etc.

data selecting

    :datalist     cls      echo.     echo datas     echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍ     echo test     echo test02     echo test03      set /p datas=enter=     if %datas% == %currentdata% goto ?         ^test      ^test              ^testdata 

so see...

   datas    ---------------     test     test02     test03 

after select testdata

    :testdata     echo.     echo test data     echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍ     echo 1) load current data     echo 2) delete current data     echo 3)      set /p dataoptions=enter=     if %dataoptions% equ 1 goto %test%data     if %dataoptions% equ 2 del %test%data     if %dataoptions% equ 3 goto datalist 

this see

    test data     --------------     1) load current data     2) delete current data     3) 

so need have operate every time make new data adds function of if %datas% == %currentdatas% , when choose data can delete it.

if datas dynamic array, can't hard code them in batch, have iterate.

this means can't use goto :%...%, %...% unexpected, , labels written!

handling arrays in batch isn't easy, possible. sure have setlocal enabledelayedexpansion @ batch start.

step 1: show datas - assume datas files on profiles/users/data

:datalist set data_count=0 %%i in (profiles\users\data\*) (     set /a data_count+=1     set %data[!data_count!]%=%%i     echo !data_count!) %%i ) 

step 2: user input

set /p datas=enter= rem sure thar %datas% number: set /a datas*=1 if %datas% geq 1 if %datas% leq %data_count% (     set test=!data[%datas%]!     rem note on, selected data stored in %test%     goto :testdata ) echo invalid option! pause goto :datalist 

step 3: operation on data

:testdata echo test data: %test% echo ----------------- echo 1) load current data echo 2) delete current data echo 3) set /p dataoption=enter= set /a dataoption*=1 if %dataoptions% equ 1 goto :load_data if %dataoptions% equ 2 (     del %test%     goto :datalist ) if %dataoptions% equ 3 goto :datalist echo invalid option! pause goto :testdata 

good luck!


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -