Command Line

 


Use keywords to find the content you
are looking for with in the site.

Environment Variables

Environment variables can be used to store a sequence of characters which can be instanciated or manipulated using the SET, XSET or LET commands from either the WinOne® prompt or at various points within a batch program.

Standard Environment Variables

Standard environment variables have the format %name%. For example, %COMSPEC% inside a batch program will be replaced with D:\WINDOWS\SYSTEM32\CMD.EXE. This value is system dependent and may vary from system to system.

Multi-dimensional Environment variables

Multi-dimensional environment variables have the following syntax :-

    NAME.INDEX1.INDEX2.INDEX3....
where NAME is the name of the environment variable and INDEX1, INDEX2 and so on specifies the index values, which may either be an integer value or the name of another environment variable which contains an integer value. Consider the following example, where the index value is specified by the contents of another environment variable :-
    SET idx=0
    SET array.idx=10
    ECHO %array.idx%
When WinOne® encounters the environment variable array.idx then the idx part is replaced with the contents of the idx environment variable, mapping the final name to array.0. The environment variable array.0 is then created and assigned the value 10. The ECHO command will display the value 10. Continuing from the above example ::-
    LET idx=%idx% + 1
    SET array.idx=20
    ECHO %array.idx%
Now the environment variable idx will contain the value 1 and the environment variable array.1 is created and assigned the value 20. The ECHO command will display the value 20. Continuing from the above example :-
    FOR %%i is 0 to 1 DO ECHO %array.%%i%
the FOR loop is identical to the following :-
    ECHO %array.0%
    ECHO %array.1%
and will display the value 10 on the first line and the value 20 on the second line.

Dynamic Environment Variables

Dynamic environment variables are environment variables that contain values that are determined dynamically, that is, at the time they are instanciated. The following dynamic environment variables are allowed :-

    ERRORLEVELLast errorlevel set
    DATE_FORMATSystem date format string
    DATE_TODAYCurrent date (formatted according to DATE_FORMAT)
    DATE_YEARCurrent year (yyyy)
    DATE_MONTHCurrent month (mm)
    DATE_DAYCurrent day (dd)
    DATE_DAYOFWEEKCurrent day of the week (0=Sun)
    TIME_TODAYCurrent time (hh:mm:ss in 24 hour format)
    TIME_HOURCurrent hour (hh as 24 hour)
    TIME_MINUTECurrent minute (mm)
    TIME_SECONDCurrent second (ss)
    DISK_DRIVECurrent disk drive letter (A, B, C ...)
    DISK_PATHCurrent working directory.
    SCREEN_WIDTHCurrent screen width
    SCREEN_HEIGHTCurrent screen height
    WHERE_XHorizontal cursor location (starting from 0)
    WHERE_YVertical cursor location (starting from 0)
    WINDOWS_VERSIONWindows version number
    WINONE_VERSIONWinOne® version number
    WINONE_PATHWinOne® home directory
    WINONE_FILENAMEFull path of the WinOne® executable
    OPERATING_SYSTEMOperating system (WinNT, Win32s or OTHER)
    RANDOM_NUMBERRandom number (0 to 65534)
To use these dynamic environment variables, enclose the name in between percentage characters. For example to display the system date format, enter at the WinOne® prompt :-

The system date format string displayed is system dependent and may vary from system to system.

Copyright © 1995-2018 Lucien Cinc, All Rights Reserved
WinOne® is an Australian registered trademark

Go to the Australian Command Line Software web site.