如何在 cmd(命令行)中的 setx 命令参数中使用全局变量

How to use global variable in arguments to setx command in cmd (command line)

执行

setx /m DESKTOP %UserProfile%\Desktop

真实结果

set DESKTOP
DESKTOP=C:\Users\dkurlyanov\Desktop

想要的结果

set DESKTOP
DESKTOP=%UserProfile%\Desktop

我只对通过控制台的选项感兴趣

来自“Compo”的正确答案

setx /m DESKTOP ^%UserProfile^%\Desktop