Search code examples
batch-fileapplication-poolrecycle

Recycle several application pools in bat file


I'm trying to recycle several of my application pool using commands in a bat file but it doesn't work.

This is my file :

%windir%\system32\inetsrv\appcmd recycle apppool /apppool.name:AppPool1
%windir%\system32\inetsrv\appcmd recycle apppool /apppool.name:AppPool2
%windir%\system32\inetsrv\appcmd recycle apppool /apppool.name:AppPool3
%windir%\system32\inetsrv\appcmd recycle apppool /apppool.name:AppPool4

This is the response in cmd :

Failed to process input: The parameter 'recycle' must begin with a / or - (HRESULT=80070057).

I've tried to had the command start at the beginning of each line but it doesn't work either.

Thanks for your help.


Solution

  • you saved your file in unix format, which uses single linefeed characters. DOS/windows needs carriage-return/linefeed pairs. check your notepad++ settings, or use regular notepad to edit the file.

    edit: see here for Notepad++ line endings setting: http://techtips-it.blogspot.co.at/2011/04/can-i-convert-file-format-in-notepad.html