Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.


Go Back   Vista Forums > Misc Newsgroups > PowerShell

RB

Vista - Commenting out a block

Reply
 
12-27-2006   #1
John Smith


 

Commenting out a block

What is the method for commenting out a block? /* .. */ doesn't work for
me.

Thanks.

My System SpecsSystem Spec
12-27-2006   #2
Jeffrey Snover [MSFT]


 

Re: Commenting out a block

Sadly no. Please suggest this.
The way I do it is
if (0) {
.............
..............
}

--
Jeffrey Snover [MSFT]
Windows PowerShell Architect
Microsoft Corporation
This posting is provided "AS IS" with no warranties, no confers rights.


My System SpecsSystem Spec
12-27-2006   #3
John Smith


 

Re: Commenting out a block

Thanks. Does the stuff between the { } have to be syntatically correct (other
than matching {}'s) since this is a script and not compiled?

"Jeffrey Snover [MSFT]" wrote:

> Sadly no. Please suggest this.
> The way I do it is
> if (0) {
> ............
> .............
> }
>
> --
> Jeffrey Snover [MSFT]
> Windows PowerShell Architect
> Microsoft Corporation
> This posting is provided "AS IS" with no warranties, no confers rights.
>
>

My System SpecsSystem Spec
12-28-2006   #4
Jeffrey Snover [MSFT]


 

Re: Commenting out a block

> Thanks. Does the stuff between the { } have to be syntatically correct
> (other
> than matching {}'s) since this is a script and not compiled?

Right - that is the downside of that technique - it has to be syntatically
correct. Here is what you want to use:

$IWishPowerShellHadBlockComments = @'
.....
.....
'@

You can put anything in a here string.

--
Jeffrey Snover [MSFT]
Windows PowerShell Architect
Microsoft Corporation
This posting is provided "AS IS" with no warranties, no confers rights.


My System SpecsSystem Spec
12-28-2006   #5
Keith Hill [MVP]


 

Re: Commenting out a block

"Jeffrey Snover [MSFT]" <jsnover@ntdev.microsoft.com> wrote in message
news:206EEC8A-C24B-450F-BC7E-1E8FBFCD0526@microsoft.com...
>> Thanks. Does the stuff between the { } have to be syntatically correct
>> (other
>> than matching {}'s) since this is a script and not compiled?

> Right - that is the downside of that technique - it has to be syntatically
> correct. Here is what you want to use:
>
> $IWishPowerShellHadBlockComments = @'
> ....
> ....
> '@


Watch out and make sure there is no whitespace after the initial @'.

--
Keith


My System SpecsSystem Spec
12-29-2006   #6
Brandon Shell


 

Re: Commenting out a block

Or use an IDE like Powershell Analyzer that had VS.NET like comment ability
(one of my favorite features... that is auto outline!!!)

"Keith Hill [MVP]" <r_keith_hill@no.spam.thank.u.hotmail.com> wrote in
message news:eB2MK4sKHHA.4384@TK2MSFTNGP03.phx.gbl...
> "Jeffrey Snover [MSFT]" <jsnover@ntdev.microsoft.com> wrote in message
> news:206EEC8A-C24B-450F-BC7E-1E8FBFCD0526@microsoft.com...
>>> Thanks. Does the stuff between the { } have to be syntatically correct
>>> (other
>>> than matching {}'s) since this is a script and not compiled?

>> Right - that is the downside of that technique - it has to be
>> syntatically correct. Here is what you want to use:
>>
>> $IWishPowerShellHadBlockComments = @'
>> ....
>> ....
>> '@

>
> Watch out and make sure there is no whitespace after the initial @'.
>
> --
> Keith
>


My System SpecsSystem Spec
Reply

RB


Thread Tools


Similar Threads for: Commenting out a block
Thread Forum
commenting multiline pipelines PowerShell
block sender Vista mail
block IE7 Vista security
XPS PRinting and Commenting Similar to PDF Abilities Vista print fax & scan
commenting lines PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd