hi all,
I made a very easy script which returns the name of the services configured as auto but actually stopped.
script:
@echo off
wmic service where 'startmode="auto" and state="stopped"' get name
The problem is that the output I receive is like this:
Name
gupdate
sppsvc
VMAuthdService
And I would like it to appear this way(without the "Name" title):
gupdate sppsvc VMAuthdService
is it possible? thanks
make an output appear in the same line
Moderator: DosItHelp
Re: make an output appear in the same line
you might try this:
Btw. I really don't like wmic![Smile :)](./images/smilies/icon_smile.gif)
Code: Select all
@ECHO OFF &SETLOCAL ENABLEDELAYEDEXPANSION
FOR /f "usebackqdelims=" %%a IN (`wmic service where 'startmode^="auto" and state^="stopped"' get name`) DO (
FOR /f %%b IN ("%%~a") DO (
SET /a counter+=1
IF !counter! gtr 1 SET "line=!line! %%b"
)
)
SET "line=%line:~1%"
ECHO(%line%
Btw. I really don't like wmic
![Smile :)](./images/smilies/icon_smile.gif)
Re: make an output appear in the same line
you might try this:
Code:
@ECHO OFF &SETLOCAL ENABLEDELAYEDEXPANSION
FOR /f "usebackqdelims=" %%a IN (`wmic service where 'startmode^="auto" and state^="stopped"' get name`) DO (
FOR /f %%b IN ("%%~a") DO (
SET /a counter+=1
IF !counter! gtr 1 SET "line=!line! %%b"
)
)
SET "line=%line:~1%"
ECHO(%line%
Btw. I really don't like wmic
great, just the solution I was looking for
thanks man
![Smile :)](./images/smilies/icon_smile.gif)