Done Just a Help addition - Set can indirectly set variables

Oct 18, 2009
362
17
No change to the code, but point out the following in the Help for Set:

Set can indirectly set variables:

UNSET Hello

Set var=Hello
:: Will echo Hello
Echo %var

Set %var=Goodbye

:: Will echo Hello
Echo %var
:: Will echo Goodbye
Echo %Hello
Here's a practical use example:

:: Just for demonstration
Unset MyFile Filename_var

GOSUB SELECT_FILE *.txt MyFile

:: Just for demonstration
Echo MyFile: %MyFile
Echo Filename_var: %Filename_var

quit

::******************************************************
:SELECT_FILE [Pattern Filename_var]
::
:: Gets filename
:: If no name is picked QUITS THE PROGRAM.
::
:: Parameters:
:: Pattern: pattern match for SELECT command
:: Filename_var: Holds the name of the VARIABLE
:: that the selected filename will be stored in
::
:: CALL WITH:
:: GOSUB SELECT_FILE Pattern MyFileVarName
::
::******************************************************

SELECT /1 SET tmp=(%Pattern)

:: No name picked (Esc pressed)
IFF "%tmp" EQ "" THEN
:: No file specified
ECHO.
ECHO NO FILE NAME SPECIFIED ! -- EXITING
PAUSE
QUIT
ENDIFF

Set %Filename_var=%tmp
UNSET tmp

RETURN
:: End of SELECT_FILE [Pattern Filename_var]​
 
Similar threads
Thread starter Title Forum Replies Date
R Done Just a Help addition - Alias name can use variables Suggestions 1
Joe Caverly Link in Help File to Blog Articles Suggestions 0
Joe Caverly Declined Update FFIND in Help File with example for ORing expressions to search for Suggestions 6
R Declined Help system improvements Suggestions 11
x13 Done Typo in help file (including PDF) | v24.02.46 Suggestions 0
R User-created extended help (probably in a text file): DIRHISTORY /?x Suggestions 10
R Done Add to Pause Help text re indenting the prompt Suggestions 0
N Done Update help (more) and new tutorials Suggestions 8
Joe Caverly Declined Help File "See Also" Suggestions 4
rps Declined Remember the Help "Select Topic" window settings Suggestions 4
C Done Help suggestion TCMD Suggestions 3
M Declined A sticky thread to report HELP issues Suggestions 0
rconn Declined Help file organization Suggestions 0
rconn In the Help tab let the user add links either to files or web pages, with an icon & label. Suggestions 0
R Documentation CLARIFY START /C HELP Suggestions 0
Alpengreis Declined Any chance for quick help with all command-options? Suggestions 3
Roedy Done better redirection help Suggestions 1
Roedy Done Augmented Help Suggestions 0
T Done Help for SET to include @ExecStr[] hint Suggestions 1
S Declined Plugin Help Suggestions 2
S Done Command and help enhancement, esp. ALIAS, FUNCTION and SET Suggestions 2
Charles Dye Done v11 suggestion: plugin online help interface Suggestions 0
Charles Dye Declined Help file request Suggestions 2
S Done Debugger window HELP pulldown menu Suggestions 3
E Done move @unquote, @unquotes in help docs Suggestions 0
rps Done Pause /wait option addition Suggestions 1
C Feature Request: Gain some elements of the XXCOPY feature set in COPY or a new "Mass-Copy" command Suggestions 0
D Done BDEBUGGER: add cmdline option to set a breakpoint at a given line Suggestions 0
Charles Dye Done PRINT: Option to set default printer Suggestions 0
R Save and load a command dialog set and name it Suggestions 3
R Done IDE copy (OR REMOVE) Set var name to Watch list by hotkey Suggestions 2
R Done For development or test purposes SET date and time INTERNAL variables Suggestions 3
L Completing the UnQLite command's option set Suggestions 0
J Done Set font in Take Command tabs in a .btm Suggestions 1
rconn Done Set permissions for FTP files Suggestions 0
S Done Enhanced ALIAS, SET, ESET and FUNCTION commands Suggestions 0
A Done Using mouse to set cursor location in command prompt Suggestions 0

Similar threads