Skip to content
Fix Code Error

How do you comment out code in PowerShell?

March 13, 2021 by Code Error
Posted By: Anonymous

How do you comment out code in PowerShell (1.0 or 2.0)?

Solution

In PowerShell V1 there’s only # to make the text after it a comment.

# This is a comment in Powershell

In PowerShell V2 <# #> can be used for block comments and more specifically for help comments.

#REQUIRES -Version 2.0

<#
.SYNOPSIS
    A brief description of the function or script. This keyword can be used
    only once in each topic.
.DESCRIPTION
    A detailed description of the function or script. This keyword can be
    used only once in each topic.
.NOTES
    File Name      : ✘✘✘x.ps1
    Author         : J.P. Blanc ([email protected])
    Prerequisite   : PowerShell V2 over Vista and upper.
    Copyright 2011 - Jean Paul Blanc/Silogix
.LINK
    Script posted over:
    http://silogix.fr
.EXAMPLE
    Example 1
.EXAMPLE
    Example 2
#>
Function blabla
{}

For more explanation about .SYNOPSIS and .* see about_Comment_Based_Help.

Remark: These function comments are used by the Get-Help CmdLet and can be put before the keyword Function, or inside the {} before or after the code itself.

Answered By: Anonymous

Related Articles

  • Call PowerShell script PS1 from another PS1 script…
  • Changing PowerShell's default output encoding to UTF-8
  • How to design a controller in Backbone.js?
  • Is there a way to run multiple powershell scripts in…
  • How can I get the current PowerShell executing file?
  • Search match multiple values in single field in…
  • Calculate median for an array of objects
  • Fix top buttons on scroll of list below
  • Is it possible to apply CSS to half of a character?
  • setTimeout function not working : javascript
  • What is a NullReferenceException, and how do I fix it?
  • How can prevent a PowerShell window from closing so…
  • Python lambda & list
  • how to add data to a user's profile while not…
  • Bot will not log an automod event if user has…
  • What are the undocumented features and limitations…
  • How can I find the product GUID of an installed MSI setup?
  • How to filter a RecyclerView with a SearchView
  • How to parse an RSS feed using JavaScript?
  • Invoke a second script with arguments from a script
  • Adding git branch on the Bash command prompt
  • Rendering nested list with v-for and vue components
  • data.table vs dplyr: can one do something well the…
  • VueJS masonry layout
  • Ukkonen's suffix tree algorithm in plain English
  • How to run a Powershell script from the command line…
  • Vue custom directive uses the updated Dom (or $el)
  • getting error while updating Composer
  • What's the difference between eval, exec, and compile?
  • How to verify authentication token of multiple type…
  • python 3.2 UnicodeEncodeError: 'charmap' codec can't…
  • insert tables in dataframe with years from 2000 to…
  • Mapping JSON to backbone.js collections
  • Why do git fetch origin and git fetch : behave differently?
  • Checkout another branch when there are uncommitted…
  • How to paste yanked text into the Vim command line
  • Pandas pivot_table: filter on aggregate function
  • Maven2: Missing artifact but jars are in place
  • After a little scroll, the sticky navbar just is not…
  • How do SO_REUSEADDR and SO_REUSEPORT differ?
  • Map key of object with array of object value
  • Why is my locally-created script not allowed to run…
  • What does "Fatal error: Unexpectedly found nil while…
  • In PowerShell, how do I define a function in a file…
  • Backbone.js `listento` not firing for a filtered collection
  • What is the scope of variables in JavaScript?
  • Django Blog - Comment System
  • Identifying and solving…
  • Backbone-relational fetchRelated not sending request
  • Active tab issue on page load HTML
  • Smart way to truncate long strings
  • Ember Data nested resource URL
  • How to run a PowerShell script
  • What is your most productive shortcut with Vim?
  • Simplest way to create Unix-like continuous pipeline…
  • laravel vuejs/axios put request Formdata is empty
  • How to use html template with vue.js
  • Laravel, Vue.js array empty
  • Vue.js get element's html value by clicking on it's…
  • How to set a limit to a list? python
  • How do I rotate text in css?
  • Add new Item with ember.js
  • (Mac) -bash: __git_ps1: command not found
  • Powershell Script - Reinstalling Application
  • Spring Boot - Cannot determine embedded database…
  • kafka + Best Practices For Apache Kafka…
  • how to inject a store into a component (when using…
  • Where and why do I have to put the "template" and…
  • Can't find why the if block not getting executed
  • The null object does not have a method []=
  • PreLaunchTask could not find the task - Powershell
  • How to generate a random string of a fixed length in Go?
  • How does PHP 'foreach' actually work?
  • Passing an object to element attribute in Polymer 2
  • Spring data jpa- No bean named…
  • jQuery.on() Delegation: Slightly complex selector…
  • How to use multiple models with a single route in…
  • How to handle command-line arguments in PowerShell
  • How to pass boolean values to a PowerShell script…
  • For-each over an array in JavaScript
  • SQLGrammarException:error executing work ORA-01722:…
  • How do I deal with installing peer dependencies in…
  • Ember Data. Save model with "belongsTo" relationship
  • Live chat scraping (Youtube) with casper. Issue with…
  • SQL find sum of entries by date including previous date
  • How can I pass a wct test while rearranging children…
  • PowerShell says "execution of scripts is disabled on…
  • How to run PowerShell in CMD
  • Change the location of the ~ directory in a Windows…
  • Why does C++ code for testing the Collatz conjecture…
  • How do I pass named parameters with Invoke-Command?
  • Usage of __slots__?
  • How to horizontally align ul to center of div?
  • How to make Lodash orderBy to sort only the records…
  • Specifying java version in maven - differences…
  • VueJS Loading More Blog Posts
  • What are the new features in C++17?
  • Show only certain items at certain condition on…
  • java.lang.ClassNotFoundException:…
  • What is an optional value in Swift?

Disclaimer: This content is shared under creative common license cc-by-sa 3.0. It is generated from StackExchange Website Network.

Post navigation

Previous Post:

How to set Bullet colors in UL/LI html lists via CSS without using any images or span tags

Next Post:

WAMP error: Forbidden You don’t have permission to access /phpmyadmin/ on this server

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

.net ajax android angular arrays aurelia backbone.js bash c++ css dataframe ember-data ember.js excel git html ios java javascript jquery json laravel linux list mysql next.js node.js pandas php polymer polymer-1.0 python python-3.x r reactjs regex sql sql-server string svelte typescript vue-component vue.js vuejs2 vuetify.js

  • you shouldn’t need to use z-index
  • No column in target database, but getting “The schema update is terminating because data loss might occur”
  • Angular – expected call-signature: ‘changePassword’ to have a typedeftslint(typedef)
  • trying to implement NativeAdFactory imports deprecated method by default in flutter java project
  • What should I use to get an attribute out of my foreign table in Laravel?
© 2022 Fix Code Error