首页 / MYSQL / Powershell批处理模板
Powershell批处理模板
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了Powershell批处理模板,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含3422字,纯文字阅读大概需要5分钟。
内容图文
![Powershell批处理模板](/upload/InfoBanner/zyjiaocheng/560/c57fda63037e45e6a77dc47ec62e78e2.jpg)
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.My
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|&$log try{ #your ps code $psversiontable|&$log $Script:pss = ps $Script:i = 0 foreach ($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 ech【本文来自鸿网互联 (http://www.68idc.cn)】o ---------------------------------------------------------------- CHOICE /c 12 /M "Choice->" if errorlevel 2 GOTO exit if errorlevel 1 GOTO GenA rem Generate Append :GenA cls echo starting powershell,Generate Append powershell -file %cd%\common.ps1 -nologo -version %vers% -Mta echo finished rem timeout 2 pause goto :Entrance rem Generate Merge :GenM cls echo starting powershell,Generate Merge rem powershell -file %cd%\module\GenerateMerge.ps1 -nologo -version %vers% -Mta echo finished pause goto :Entrance rem Depoly :Depo cls echo Caching sqlcmd files to local. powershell -file %cd%\Mail\Send-AvEmail.ps1 -nologo -version %vers% -Mta echo finished pause goto :Entrance rem clear :clea cls echo clearing CachedSQLS rem powershell -file %cd%\module\ClearCachedSQLS.ps1 -nologo -version %vers% -Mta echo finished pause goto :Entrance rem Set-ExecutionPolicy -ExecutionPolicy remotesigned :setP cls echo Set-ExecutionPolicy -ExecutionPolicy remotesigned powershell -file %cd%\module\Set-ExecutionPolicy.ps1 -nologo -version %vers% -Mta echo finished pause goto :Entrance rem Config :Conf cls echo configuring powershell inittial parameters: echo edit and save to contiue. rem echo editing %cd%\module\config rem notepad %cd%\module\config echo editing %cd%\module\config_sys notepad "%cd%\module\config_sys" echo testing config_sys powershell -file %cd%\module\TestConfig.ps1 -nologo -version %vers% -Mta pause goto :Entrance rem Help :Help cls @type %cd%\module\help.txt pause goto :Entrance rem SqlCMD :SqlC cls powershell -file %cd%\module\GenerateSqlcmdFiles-force.ps1 -nologo -version %vers% -Mta pause goto :Entrance rem default :N cls echo Invalid Selection! Try again @type %cd%\module\help.txt pause goto :Entrance rem exit :Exit exit
内容总结
以上是互联网集市为您收集整理的Powershell批处理模板全部内容,希望文章能够帮你解决Powershell批处理模板所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。