locked
Error in power shell command RRS feed

  • Question

  • Hello Experts!!!

    While executing the command in powershell getting error!!!

    CMDLINE

    & cmd.exe /c "taskkill /f /fi 'services eq wuauserv'" | Out-Null

    ERROR

     

    cmd.exe : ERROR: Invalid argument/option - 'eq'.
    At line:1 char:1
    + & cmd.exe /c ("taskkill /f /fi 'services eq wuauserv'")
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (ERROR: Invalid argument/option -  
       'eq'.:String) [], RemoteException
        + FullyQualifiedErrorId : NativeCommandError

    Type "TASKKILL /?" for usage.

    Please let know how to run the command line without issue.


    THANKS SURESH M

    Friday, October 18, 2019 10:05 AM

Answers

All replies

  • Did you follow the tip Type "TASKKILL /?" for usage? There are examples how to use the command. Compare the examples to your command and you'll notice the difference.  (Hint: note the quotation markes)

    BTW: it's not a Powershell command - you can use it in native cmd as well AND because Powershell is a shell as well you don't need to start cmd from Powershell you can run this command in Powershell .


    Live long and prosper!

    (79,108,97,102|%{[char]$_})-join''

    • Edited by BOfH-666 Friday, October 18, 2019 11:31 AM
    Friday, October 18, 2019 11:27 AM
  • Did you follow the tip Type "TASKKILL /?" for usage? There are examples how to use the command. Compare the examples to your command and you'll notice the difference.  (Hint: note the quotation markes)

    BTW: it's not a Powershell command - you can use it in native cmd as well AND because Powershell is a shell as well you don't need to start cmd from Powershell you can run this command in Powershell .


    Live long and prosper!

    (79,108,97,102|%{[char]$_})-join''

    Thanks for your response!!!

    I am writing a powershell script in which the cmd command need to execute to fix few errors.
    That is the reason i am trying the cmd command line in powershell.
    More over the cmd command line is correct and its working in cmd without any issue.

    THANKS SURESH M

    Friday, October 18, 2019 1:15 PM
  • If its a Powershell script anyway you should use native Powershell cmdlets like Get-Service, Set-Service, Stop-Service, Get-Process, Stop-Process and so on ....

    Live long and prosper!

    (79,108,97,102|%{[char]$_})-join''

    • Proposed as answer by jrv Friday, October 18, 2019 5:25 PM
    • Marked as answer by Richard MuellerMVP Friday, October 25, 2019 2:18 PM
    Friday, October 18, 2019 2:30 PM