I tried the code below but it does not work:
for /f "usebackq tokens=*" %%a in (`CSCRIPT "C:/../myvbs.vbs"`) do set num=%%a
echo %num%
In the myvbs.vbs code, I am passing the number as follows:
wscript.echo number
Apart from the forward slashes which should be backward slashes, you've stipulated to use back quotes without using them.
for /f "usebackq tokens=*" %%a in (`CSCRIPT "C:\..\myvbs.vbs"`) do…
Although technically they shouldn't be needed
for /f "tokens=*" %%a in ('CSCRIPT "C:\..\myvbs.vbs"') do…
for /f "usebackq tokens=*" %%a in ('CSCRIPT "C:/../myvbs.vbs"') do set num=%%ausebackqis provided, enclose the command line within back-ticks; withoutusebackq, use apostrophes...