An AutoLISP function whose name begins with c: becomes a command-line command.
Define a command
(defun c:ASKNAME (/ name)
(setq name (getstring T "\nYour name: "))
(prompt (strcat "\nHello, " name "."))
(princ)
)
After loading the file, type ASKNAME. The local variable list (/ name) prevents name from leaking into the wider drawing session.
Read the expression from inside out
getstringasks for text.setqstores the returned text inname.strcatjoins text values.promptwrites a message to the command line.princgives the command a quiet exit.
Make the failure path clear
Real routines should check user input and handle cancellation. Keep the first version small, then add validation after the happy path works.
Use the function reference to inspect each building block.