You can do this on the same line, but I would recommend using a batch file like preHook.bat.
Like one liner
set "mu=hello, world!" && call echo %^mu%
At first you can see that the quotation marks are different from yours.
That's why:
set test1="quotes" set "test2=no quotes" with comment
In the first test, quotation marks will be part of the variable test1 , as well as all characters after the last quote.
In the second test, it uses the extended syntax of the SET command.
Thus, the content will be no quotes , since only the content of the last quote is used; the rest will be deleted.
To reflect the contents of a variable, I use call echo %^mu% , since a percentage extension will expand it when the string is parsed, before executing any of the commands.
But the call command will be executed later, and it will restart the parser, which when used on the command line uses different extension rules than the batch parser: an empty variable (in this case %^mu% , for the first time) remains unchanged in the line; but in the next phase of the syntax, the carriage ^ will be deleted.
In your case, call echo %mu% will also work, but only when mu always empty. The carriage option also works when mu has content before the line is executed.
Read more about the parser in SO: How is the Windows Command Interpreter script interpreter (CMD.EXE)? And about variable extension on SO: variable extension
jeb
source share