I'm entering something like that
Desktop>wmic environment where(name="PATH" and systemVariable=FALSE) get variableValue
VariableValue
xxx
But I don't want VariableValue
to get into output. I want simply get xxx
Is it possible?
Answer
I don't want VariableValue to get into output. I want simply get xxx Is it possible?
Using a batch file:
@echo off
setlocal
for /f "usebackq skip=1 tokens=*" %%i in (`wmic environment where ^(name^="PATH" and systemVariable^=FALSE^) get variableValue ^| findstr /r /v "^$"`) do echo %%i
endlocal
Using a command line:
for /f "usebackq skip=1 tokens=*" %i in (`wmic environment where ^(name^="PATH" and systemVariable^=FALSE^) get variableValue ^| findstr /r /v "^$"`) do @echo %i
Notes:
for /f
loops through thewmic
output.skip=1
skips the header line (containingVariableValue
)findstr /r /v "^$"
removes the trailing blank line from thewmic
output.
Example output:
C:\Users\DavidPostill\AppData\Roaming\npm
No comments:
Post a Comment