0

myMainScript.bat

@echo off
set myValue=$(call lib/helloWorld.bat)
echo myValue: %myValue%

helloWorld.bat

@echo off
echo "hello world!"

This does not work, how to set the echo of another script as a variable?

theAnonymous
  • 1,687
  • 2
  • 24
  • 59
  • `for /F "delims=" %%a in ('lib\helloWorld.bat') do set "myValue=%%a"`. You may also do: `call lib\helloWorld.bat > tempFile.txt` and then: `set /P "myValue=" < tempFile.txt` – Aacini Aug 26 '21 at 16:04

0 Answers0