Answer the question
In order to leave comments, you need to log in
How to execute CMD commands in one line?
Script
set /a M=%NUMBER_OF_PROCESSORS%/2
echo %M% > 1.txt
set /a M=%NUMBER_OF_PROCESSORS%/2 & echo %M% > 1.txt
Answer the question
In order to leave comments, you need to log in
Environment variables are fully supplied in a compound command before it is executed (to see this, you can leave the command output mode on):
set a=1
set a=2& echo %a%
set a=1
(
set a=2
echo %a%
)
cmd.exe
must be launched with a key /v
, or the mode of delayed variable expansion by default must be set in the registry (see set /?
, setlocal /?
, cmd /?
). call
:set /a
for delayed expansion of variables, they can be written not as %var%
or !var!
, but simply var
:set /a M = NUMBER_OF_PROCESSORS / 2
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question