powershell - How do I escape the "&" symbol in Sql server -
i have execute following code in query editor
exec xp_cmdshell 'sqlps -command "$http=new-object system.net.webclient;$http.uploadstring(\"http://192.168.2.3:8080/thermalmap/dbtest.jsp\",\"param1=somevalue & param2=thriu\")"'
it gives me error.
but following code working , gives me output
exec xp_cmdshell 'sqlps -command "$http=new-object system.net.webclient;$http.uploadstring(\"http://192.168.2.3:8080/thermalmap/dbtest.jsp\",\"param1=somevalue\")"'
here in second code passing single parameter , don't error if pass 2 parameter need add "&" symbol , getting error. how can escape "&" symbol here?
according this article need escape ampersands this: ^&
. unescaped ampersands treated command separators.
Comments
Post a Comment