WMIC command not working in .bat file

Solver

I'm new to WIMC so probably there will be simple answer to my question.

If I will open CMD and run this command:

wmic /OUTPUT:C:\LogServices.txt service where "not PathName like '%Windows%'" get DisplayName,Name,PathName,State,StartMode

this will generate file with all services not in windows folder.

If I will save above command in bat file and run this will generate list all services somehow ignoring WHERE statement. Running this as Administrator not changing anything.

rojo

In a batch script you have to double pump the % signs so they'll be treated as literal percent signs. Change your command to this and it'll work:

wmic /OUTPUT:C:\LogServices.txt service where "not PathName like '%%Windows%%'" get DisplayName,Name,PathName,State,StartMode

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

Text file Side by Side Merge not working via Bat file

분류에서Dev

how to get all the arguments in a command captured in a windows .bat file

분류에서Dev

How would I send a command if a .bat file is closed?

분류에서Dev

how to call a path from .ini file into bat command string?

분류에서Dev

batch file - wmic - empty line

분류에서Dev

"No Instance(s) Available" error with the wmic command

분류에서Dev

How can I remove the last blank line of a wmic command?

분류에서Dev

Find and replace a character in xml file using sed command is not working

분류에서Dev

Launching a .reg within a .bat file

분류에서Dev

wmic를 사용할 때 bat 파일 오류 "잘못된 동사 전환"오류

분류에서Dev

Getting grunt command not working

분류에서Dev

simple command "find" not working

분류에서Dev

ps command not working properly?

분류에서Dev

Shell command 'Join' not working

분류에서Dev

top command not working

분류에서Dev

putFile command is not working

분류에서Dev

How to sign a Windows batch (.bat) file?

분류에서Dev

Recursive directory processing in a BAT file with a twist

분류에서Dev

Bat file returns error but works correctly

분류에서Dev

What is wrong with my if parameter syntax of this .bat file?

분류에서Dev

Open corresponding remote directory with bat file

분류에서Dev

How to start an application Maximized using a .bat file?

분류에서Dev

What is the wrong with this .bat excuting FFmpeg command using variables?

분류에서Dev

How to launch a .bat file in VB without associating the file with the program that launched it?

분류에서Dev

Replace a middle string in .bat file using AutoHotKey without deleting file

분류에서Dev

SED command not replacing (working regex)

분류에서Dev

Why this below exec command is not working

분류에서Dev

sed command not working with search string

분류에서Dev

Command not working properly in shell script

Related 관련 기사

  1. 1

    Text file Side by Side Merge not working via Bat file

  2. 2

    how to get all the arguments in a command captured in a windows .bat file

  3. 3

    How would I send a command if a .bat file is closed?

  4. 4

    how to call a path from .ini file into bat command string?

  5. 5

    batch file - wmic - empty line

  6. 6

    "No Instance(s) Available" error with the wmic command

  7. 7

    How can I remove the last blank line of a wmic command?

  8. 8

    Find and replace a character in xml file using sed command is not working

  9. 9

    Launching a .reg within a .bat file

  10. 10

    wmic를 사용할 때 bat 파일 오류 "잘못된 동사 전환"오류

  11. 11

    Getting grunt command not working

  12. 12

    simple command "find" not working

  13. 13

    ps command not working properly?

  14. 14

    Shell command 'Join' not working

  15. 15

    top command not working

  16. 16

    putFile command is not working

  17. 17

    How to sign a Windows batch (.bat) file?

  18. 18

    Recursive directory processing in a BAT file with a twist

  19. 19

    Bat file returns error but works correctly

  20. 20

    What is wrong with my if parameter syntax of this .bat file?

  21. 21

    Open corresponding remote directory with bat file

  22. 22

    How to start an application Maximized using a .bat file?

  23. 23

    What is the wrong with this .bat excuting FFmpeg command using variables?

  24. 24

    How to launch a .bat file in VB without associating the file with the program that launched it?

  25. 25

    Replace a middle string in .bat file using AutoHotKey without deleting file

  26. 26

    SED command not replacing (working regex)

  27. 27

    Why this below exec command is not working

  28. 28

    sed command not working with search string

  29. 29

    Command not working properly in shell script

뜨겁다태그

보관