powershell PowerShell:脚本模板版本2(无需记录)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了powershell PowerShell:脚本模板版本2(无需记录)相关的知识,希望对你有一定的参考价值。

#requires -version 4
<#
.SYNOPSIS
  <Overview of script>

.DESCRIPTION
  <Brief description of script>

.PARAMETER <Parameter_Name>
  <Brief description of parameter input required. Repeat this attribute if required>

.INPUTS
  <Inputs if any, otherwise state None>

.OUTPUTS
  <Outputs if any, otherwise state None>

.NOTES
  Version:        1.0
  Author:         <Name>
  Creation Date:  <Date>
  Purpose/Change: Initial script development

.EXAMPLE
  <Example explanation goes here>
  
  <Example goes here. Repeat this attribute for more than one example>
#>

#---------------------------------------------------------[Script Parameters]------------------------------------------------------

Param (
  #Script parameters go here
)

#---------------------------------------------------------[Initialisations]--------------------------------------------------------

#Set Error Action to Silently Continue
$ErrorActionPreference = 'SilentlyContinue'

#Import Modules & Snap-ins

#----------------------------------------------------------[Declarations]----------------------------------------------------------

#Any Global Declarations go here

#-----------------------------------------------------------[Functions]------------------------------------------------------------

<#

Function <FunctionName> {
  Param ()

  Begin {
    Write-Host '<description of what is going on>...'
  }

  Process {
    Try {
      <code goes here>
    }

    Catch {
      Write-Host -BackgroundColor Red "Error: $($_.Exception)"
      Break
    }
  }

  End {
    If ($?) {
      Write-Host 'Completed Successfully.'
      Write-Host ' '
    }
  }
}

#>

#-----------------------------------------------------------[Execution]------------------------------------------------------------

#Script Execution goes here

以上是关于powershell PowerShell:脚本模板版本2(无需记录)的主要内容,如果未能解决你的问题,请参考以下文章

powershell [PS:脚本模板]只是PowerShell脚本要遵循的模板。 #PowerShell #Template

powershell脚本隐藏退出码

powershell 测量PowerShell命令或PowerShell脚本的速度

PowerShell 添加任务以使用参数运行 PowerShell 脚本

PowerShell命令与脚本(10)——脚本

powershell 远程执行bat脚本,去启动一个应用,如何让应用一直运行,powershell能正常退出?