Powershell 批处理模板
来源:互联网 发布:菜鸟网络郑州空港园区 编辑:程序博客网 时间:2024/06/05 22:43
common.ps1
cls; #Global is public#Script is internal#Script is Script#Local is current stack level#Numbered scopes are from 0..N where each step is up to stack level (and 0 is Local)$Script:PSScriptRoot =Split-Path -Parent $MyInvocation.MyCommand.Definition$Script:strDate = Get-Date -Format "yyyyMMdd"#logging path and method$Script:logfile = "$PSScriptRoot\log$($strDate).txt"$Script:log = {$input|Tee-Object -FilePath $logfile -Append}#commen$Script:rem = {$Script:i = '';1..75|%{$i += '-'};$i } #start&$rem|&$logtry{ #your ps code$psversiontable|&$log $Script:pss = ps$Script:i = 0foreach ($ps in $pss){Write-Progress -Activity "on processing..." -status "$ps...$($i.tostring() + '/' + $pss.count.tostring())" -percentcomplete ($i++/($pss.count)*100)sleep 1}}catch {"At $(Get-Date -Format “yy-MM-dd HH:mm:ss”) error occured:$_.Exception"|&$log}finally{&$rem|&$log"Finish deploying at $(Get-Date -Format “yy-MM-dd HH:mm:ss”)"|&$log }notepad "$logfile"
start.bat
@echo off @cd %cd%@set vers=2.0:Entrance cls goto Start :Start title APOMS SQL Deployment Guide echo Please select an option from the list with the corresponding key echo ---------------------------------------------------------------- echo [1] Test echo [2] Exit echo ---------------------------------------------------------------- CHOICE /c 12 /M "Choice->" if errorlevel 2 GOTO exit if errorlevel 1 GOTO GenA rem Generate Append:GenAcls echo starting powershell,Generate Appendpowershell -file %cd%\common.ps1 -nologo -version %vers% -Mtaecho finishedrem timeout 2 pausegoto :Entrance rem Generate Merge :GenMcls echo starting powershell,Generate Merge rem powershell -file %cd%\module\GenerateMerge.ps1 -nologo -version %vers% -Mtaecho finishedpausegoto :Entrancerem Depoly:Depo cls echo Caching sqlcmd files to local.powershell -file %cd%\Mail\Send-AvEmail.ps1 -nologo -version %vers% -Mtaecho finishedpausegoto :Entrancerem clear:cleacls echo clearing CachedSQLSrem powershell -file %cd%\module\ClearCachedSQLS.ps1 -nologo -version %vers% -Mtaecho finishedpause goto :Entrancerem Set-ExecutionPolicy -ExecutionPolicy remotesigned:setPcls echo Set-ExecutionPolicy -ExecutionPolicy remotesignedpowershell -file %cd%\module\Set-ExecutionPolicy.ps1 -nologo -version %vers% -Mtaecho finishedpause goto :Entrancerem Config :Conf cls echo configuring powershell inittial parameters:echo edit and save to contiue.rem echo editing %cd%\module\configrem notepad %cd%\module\configecho editing %cd%\module\config_sysnotepad "%cd%\module\config_sys"echo testing config_syspowershell -file %cd%\module\TestConfig.ps1 -nologo -version %vers% -Mtapausegoto :Entrancerem Help:Helpcls @type %cd%\module\help.txtpause goto :Entrancerem SqlCMD:SqlCcls powershell -file %cd%\module\GenerateSqlcmdFiles-force.ps1 -nologo -version %vers% -Mtapause goto :Entrancerem default:N cls echo Invalid Selection! Try again @type %cd%\module\help.txtpause goto :Entrance rem exit:Exit exit
0 0
- Powershell 批处理模板
- 切换dns批处理模板
- word模板文件损坏批处理
- PowerShell
- PowerShell
- PowerShell
- PowerShell
- PowerShell
- PowerShell
- PowerShell
- powershell
- Powershell
- PowerShell
- Powershell
- powershell
- PowerShell
- powershell
- powershell
- oracle 中序列问题的讨论
- 个性化控件收集
- 黑马程序员-Java学习06-线程1
- eclipse下清除tomcat缓存
- Visualvm远程监控配置
- Powershell 批处理模板
- Unity3D调用系统窗口选择本地文件(PC端)
- Android复制文件,文件夹
- struts1.x的国际化
- Android引导界面的实现 .
- 强、软、弱、虚引用例子
- Java Thread
- xcode 统计代码行数
- c#继承中的函数调用