Search
 
SCRIPT & CODE EXAMPLE
 

BASIC

dos assign command output to variable (when output is a single line)

FOR /F "tokens=* USEBACKQ" %%F IN (`command`) DO (
SET var=%%F
)
ECHO %var%
Comment

dos assign command output to variable (when output is of multiple lines)

SETLOCAL ENABLEDELAYEDEXPANSION
SET count=1
FOR /F "tokens=* USEBACKQ" %%F IN (`command`) DO (
  SET var!count!=%%F
  SET /a count=!count!+1
)
ECHO %var1%
ECHO %var2%
ECHO %var3%
ENDLOCAL
Comment

PREVIOUS NEXT
Code Example
Basic :: JsonFileWrapper 
Basic :: how to simulate tail in dos/cmd without tail 
Basic :: sequnce function vb.net 
Elixir :: elixir string to time 
Elixir :: elixir string to atom 
Elixir :: elixir string regex 
Elixir :: elixir module 
Elixir :: elixir check is nil 
Elixir :: elixir function arity 
Scala :: scala concatenate list 
Scala :: scala split string to list 
Scala :: scala jrtpath 
Scala :: scala linters 
Actionscript :: octahedron 
Excel :: google sheets sort column by element frequency 
Excel :: excel and formula 
Perl :: perl for loop 
Perl :: perl download images files 
Pascal :: array pascal 
Powershell :: how to download git on windows using power shell 
Gdscript :: godot saving enum names in variable 
Cobol :: python pygments install 
Assembly :: django template url with parameter 
Assembly :: vba check if object exists 
Javascript :: jquery vslidation remove spaces from input 
Javascript :: jquery remove required attribute 
Javascript :: react refresh page 
Javascript :: javascript void(0) href 
Javascript :: get tomorrows date using moment 
Javascript :: random number between 0 and 3 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =