Why does appcmd.exe behave differently when executed inside a batch file?

I have the following appcmdto add an exception to IIS7 ISAPI and CGI restrictions. The exception I am adding should look like this:

c:\perl\bin\perl.exe "%s" %s

Here is the command line:

appcmd set config -section:isapiCgiRestriction "-+[path='c:\perl\bin\perl.exe \"%s\" %s', allowed='true', description='Perl CGI']"

If you execute it from the command line, it does it correctly, however, if I execute it inside the batch file .cmd, the path becomes distorted and ends as follows:

c:\perl\bin\perl.exe "s

The problem arises because I need to avoid quotes around the first %sperl.exe parameter . But why it should behave differently in a batch file is a bit of a puzzle.

Can someone explain why this is happening?

+3
1

, "%s" %s mathing %, ( %" %). , "s.

% -sign , , :

c:\perl\bin\perl.exe "%%s" %%s
+3

Source: https://habr.com/ru/post/1763769/


All Articles