so in *.cmd file I have:
set /p variable=user input here
And now I’m supposed to do sth with this variable, but user may put here anything, even characters that are disallowed if unescaped. So have I anything in CMD toolbox to deal with this possibility. That is to create now automatically (without user awareness of what is allowed and what not) another variable that would contain all necessary characters escaped so I could use it safely in my script ?
SET /P will properly accept any input, including unescaped special characters. When it comes time to use the variable (possibly) containing special characters, you just need to use delayed expansion.
The quotes in the SET /P statement are not needed to allow special character entry. They are just there to enable a space at the end of the prompt.