Search found 2 matches
- 27 Dec 2023 07:56
- Forum: DOS Batch Forum
- Topic: Save command result in a variable
- Replies: 3
- Views: 10061
Re: Save command result in a variable
This worked for me: for /f "delims=" %%a in ( 'dism /Online /Get-Capabilities ^| findstr "OpenSSH.Server"' ) do ( set output=%%a ) Thank you so much. In case you need more lines this actually returns only the last line. To avoid this I also tried concatenation but the variable is not updated. Like t...
- 27 Dec 2023 04:36
- Forum: DOS Batch Forum
- Topic: Save command result in a variable
- Replies: 3
- Views: 10061
Save command result in a variable
Hi everyone, I'm new here and I hope I find myself well. Trying to automate processes I have difficulty saving the result of a command in a variable. The only way I've found is to save it to a file first and then load it: dism /Online /Get-Capabilities | findstr "OpenSSH.Server" > AAA.txt set /p AAA...