Quantcast
Channel: Configuration & Scripting
Viewing all articles
Browse latest Browse all 780

PSEXEC, APPCMD & Batch

$
0
0

Hello,

I've written some scripts to execute over PSEXEC, I can get the Appcmd / Batch file to execute correctly over multiple lines, but when running in a single line I'm finding that appcmd is attempting to process the entire line of code, even when using & to attempt and break the commands.

Working Code

APPCMD LIST APPPOOL /name:$=*100*

IF %ERRORLEVEL% EQU 0 (
	ECHO We found it!
) ELSE (
	ECHO We Don't Have it!
)


Failing Code

APPCMD LIST APPPOOL "/name:'$=*100*'" & IF %ERRORLEVEL% EQU 0 (ECHO We found it!) ELSE (ECHO We Don't Have it!)


The above failing code always returns the first echo, no matter if the value is correct or not.


Viewing all articles
Browse latest Browse all 780

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>