Windows command prompt: Using a variable set in the same line of a one-liner
问题 Okay, I learned that one can use & or && to combine multiple commands into a single line, but it seems that variables that are set aren't actually available for interpolation in the same line: C:\Users\Andrew>set foo=hello, world!&& echo %foo% %foo% C:\Users\Andrew>echo %foo% hello, world! Why can't I make this work, and is there any way to make it work in a single line? The reason I need a one-liner is that an external program I'm working with accepts a single command as a pre-run hook, and,