Reputation: 37
I am trying to create a batch script with a for loop that contains commands in the list. my problem is when i run commands with arguments it reads the space as a list deliminator. I intend to have several commands in the list, but for now it is only 2. the %1 is the file to write the output to.
for %%G IN ("ipconfig /all" "net start") DO (
echo %%G >> %1
%%G >> %1
)
Upvotes: 2
Views: 65
Reputation: 57252
@echo off
break>%1
for %%G IN ("ipconfig /all" "net start") DO (
echo "%%~G"
%%~G
)>>%1
use %%~G
to dequote the token.
Upvotes: 2