Tuesday, October 18, 2011

“End-of-Parameters (--)” in PowerShell

 

Hi guys,

sorry for posting after a long time :( ..

Today I was reading something and found a interesting parameter named as “End-Of-Parameters” which in represented by “double hyphens” ( – – ) .

what is the usage ?

When we use End-of-Parameters in a command or in a script after it takes every thing as argument even they looks are parameters.

example

If you want to write –Message in Write-Warning cmdlet  as a string which is also a parameter, there are two ways to do it.

1. using double quotes (“”)

Write-Warning -Message "-Message"

End-of-parameters1

and we can also do the same with using “End-of-Parameters”

2. using End-of-Parameters

Write-Warning -Message -- -Message

End-of-parameters2

 

cool isn’t :) 

Take care

Aman Dhally

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.