A method has already been devised, however this way you don’t need a temp file.
for /f "delims=" %%i in ('command') do set output=%%i
However, I’m sure this has its own exceptions and limitations.
More Related Contents:
- Set a path variable with spaces in the path in a Windows .cmd file or batch file
- Command Prompt Separation of text by Character [closed]
- What are the undocumented features and limitations of the Windows FINDSTR command?
- Displaying Windows command prompt output and redirecting it to a file
- Defining and using a variable in batch file
- Why are other folder paths also added to system PATH with SetX and not only the specified folder path?
- Can I mask an input text in a bat file?
- Which cmd.exe internal commands clear the ERRORLEVEL to 0 upon success?
- Error: “is not recognized as an internal or external command, operable program or batch file”
- Why doesn’t this FINDSTR example with multiple literal search strings find a match?
- How to read and print contents of text file line by line?
- Logical operators (“and”, “or”) in DOS batch
- using batch echo with special characters
- How to create empty text file from a batch file?
- How can a batch file run a program and set the position and size of the window?
- How can I get the value of a registry key from within a batch script?
- How to search and replace a string that have an equal-to sign “=” inside
- Arithmetic operations with HH:MM:SS times in batch file
- How do I compare timestamps of files in a batch script?
- Open a URL without using a browser from a batch file
- Why are Danish characters not displayed as in text editor on executing batch file?
- How to automatically close cmd window after batch file execution?
- Does Windows batch support exception handling?
- Batch – Converting variable to uppercase
- Get java version from batch file
- How does “FOR” work in cmd batch file?
- Why is escaping exclamation marks not necessary in parameter of `for /F` or `for /R`?
- Batch file and DEL errorlevel 0 issue
- To “Call” or “Not to Call” a batch file?
- How can I move all the files from one folder to another using the command line?