"Set /p" for Windows Mobile 6.5

MJ
María José
Daimler AG

Hello!

Do you know if there is a command for Windows Mobile 6.5 similar a “set /p” in Windows?

I’m trying to create a script in which asks about something and the user could input the information manually.

Any idea?

Thanks.

6 years ago
SOTI MobiControl
ANSWERS
JB
James Beeching
6 years ago

From my experience this is not something that I have ever been able to achieve.

May I ask what the specific requirement is? Maybe there is an alternate method that can be used.

James

G
GPMOD@SOTI Bronze Contributor
6 years ago

Hello Maria - Could you please help us understand the use case so that we can provide you with the information requested.

MJ
María José
6 years ago

Hello,

Yes, I would like to do a script like that for Windows Mobile 6.5.

----------------------------------------------------------------------------------------------------------------

@echo off
:inicio
SET var=0
cls

echo -----------------------
echo  1    Opcion 1  
echo  2    Opcion 2  
 
echo  6    Salir
echo -----------------------
echo.

SET /p var= ^> Seleccione una opcion [1-6]:

if "%var%"=="0" goto inicio
if "%var%"=="1" goto op1
if "%var%"=="2" goto op2
if "%var%"=="6" goto salir

::Mensaje de error, validación cuando se selecciona una opción fuera de rango
echo. El numero "%var%" no es una opcion valida, por favor intente de nuevo.
echo.
pause
echo.
goto:inicio

:op1
    echo.
    echo. Has elegido la opcion No. 1
    echo.
        set HKLM\IDENT opcion 1
        
    echo.
    pause
    goto:inicio

:op2
    echo.
    echo. Has elegido la opcion No. 2
    echo.
         set HKLM\IDENT opcion 2
       
    echo.
    pause
    goto:inicio

    goto:inicio

:salir
    @cls&exit

--------------------------------------------------------------------------------------------------------------------

The objetive is to save a value in the registry with some information. This information I will use with a custom data and relocation rule to move devices from one orign folder to another destination folder in Soti Mobicontrol.

In the example: if you choose "opcion 1" the device will create a value "opción" = "1". I could create a custom data, and in function of this value the relocation rule moves the device.

Sorry about my english if you don't understand!

Thanks for your help.

KA
Karim A.
6 years ago (edited 6 years ago)

Hello Maria,

There is something you can do to accomplish conditional statements based on user input, however, the solution is not as flexible as Set /P.

You can try the following:


//First condition
showmessagebox "Would you like to do something?" NO_TIMER 2 YES if %ShowMessageBoxReturn%==IDYES goto FirstConditionYes
if %ShowMessageBoxReturn%==IDNO goto FirstConditionNo

:FirstConditionYes
showmessagebox "yes"
goto end                            //We have to do this for "yes" (true), otherwise, the script will execute the everything

                                               below this point

:FirstConditionNo
goto SecondConditionBegin    //If the user selects "no" (false), we want them to enter the second condition


//Second Condition
:SecondConditionBegin
showmessagebox "Would you like to do something else?" NO_TIMER 2 YES if %ShowMessageBoxReturn%==IDYES goto SecondConditionYes
if %ShowMessageBoxReturn%==IDNO goto SecondConditionNo

:SecondConditionYes
showmessagebox "yes"
goto end

:SecondConditionNo
showmessagebox "no"
goto end (you can also go to the next condition here) 

:end

You can create a series of these conditional statements and the user should be able to enter specific sections of your script accordingly. 

This is documented in the following location:

https://www.soti.net/mc/help/v14.2/en/scriptcmds/reference/windowsmobile.html