The term 'appcmd' is not recognized as the name of a cmdlet

后端 未结 7 1178
故里飘歌
故里飘歌 2020-12-17 09:09

I\'m getting the following error message:

The term \'appcmd\' is not recognized as the name of a cmdlet, function, script file, or operable program. C

相关标签:
7条回答
  • 2020-12-17 09:40

    Open command prompt as administrator, and try....

    cd c:\windows\system32\inetsrv
    

    then type

    appcmd 
    

    see my example below

    vote up if it works for you : D

    0 讨论(0)
  • 2020-12-17 09:43

    I don't like to manually play with PATH or system env. The portable solution is to use the full path and name of the command:

    For example, to recycle an app pool:

    %systemroot%\system32\inetsrv\appcmd.exe recycle apppool /apppool.name:"my website app pool name"
    
    0 讨论(0)
  • 2020-12-17 09:47

    I had the same issue and resolved it by doing the following:

    $systemRoot = [environment]::GetEnvironmentVariable("systemroot")
    Set-Location $systemRoot\system32\inetsrv
    .\appcmd
    
    0 讨论(0)
  • 2020-12-17 09:54

    Appcmd.exe exists at the location %systemroot%\system32\inetsrv\. You either need to udpate your PATH variable to add the path %systemroot%\system32\inetsrv\ like

    SET PATH=%PATH%;%systemroot%\system32\inetsrv\
    

    or you can use Set-Location to first go to the location of Appcmd.exe like

    Set-Location %systemroot%\system32\inetsrv\
    

    and then run you command.

    0 讨论(0)
  • 2020-12-17 09:58

    I think the user has the same problem I did: %systemroot%\system32\inetsrv\ was empty on my machine.

    You need to "Turn Windows features on and off", and then select "IIS Management Scripts and Tools" under "Internet Information Services"->"Web Management Tools".

    0 讨论(0)
  • 2020-12-17 10:04

    To view your current environment paths:

    $Env:Path
    

    To add the APPCMD path:

    $Env:Path += ";C:\Windows\System32\inetsrv\"
    

    This should allow you to use your APPCMD command e.g.:

    Appcmd Set Config /Section:RequestFiltering /AllowHighBitCharacters:True
    
    0 讨论(0)
提交回复
热议问题