随笔分类 -  PowerShell

摘要:转自:https://www.cnblogs.com/woshimrf/p/5899629.html 前言 习惯了windows的界面模式就很难转去命令行,甚至以命令行发家的git也涌现出各种界面tool。然而命令行真的会比界面快的多,如果你是一个码农。 situation:接到需求分析bug,需要 阅读全文
posted @ 2021-01-27 15:54 特洛伊-Micro 阅读(1368) 评论(0) 推荐(0) 编辑
摘要:1 $dirFind='D:\BeisenDev\Src\Web.CloudSetting' 2 3 4 function Get-Encoding 5 { 6 param 7 ( 8 [Parameter(Mandatory,ValueFromPipeline,ValueFromPipelineB 阅读全文
posted @ 2020-11-24 11:16 特洛伊-Micro 阅读(577) 评论(0) 推荐(0) 编辑
摘要:1 # 合并目录下的所有文件,并以UTF8格式保存到指定文件 2 function funcCombinFilesInUTF8($fileDir, $destFile) 3 { 4 5 echo '' | out-file -Encoding utf8 -filepath $destFile 6 $ 阅读全文
posted @ 2020-05-09 17:52 特洛伊-Micro 阅读(1718) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。
posted @ 2019-10-13 00:55 特洛伊-Micro 阅读(8) 评论(0) 推荐(0) 编辑
摘要:It was only a matter of time, right? Due to my recent infatuation passionate love affair with PowerShell (whose download has been up and down on MSDN  阅读全文
posted @ 2018-04-23 00:29 特洛伊-Micro 阅读(860) 评论(0) 推荐(0) 编辑
摘要:如下说明是翻译: help Start-Sleep 产生的帮助信息.译者: Edengundam(马涛) Start-Sleep 大纲使shell, 脚本, 或运行空间的活动挂起指定的时间. 语法Start-Sleep [-seconds] [] Start-Sleep -milliseconds 阅读全文
posted @ 2017-05-04 09:15 特洛伊-Micro 阅读(744) 评论(0) 推荐(0) 编辑
摘要:DOS批处理中%cd%和%~dp0的区别 在DOS的批处理中,有时候需要知道当前的路径。 在DOS中,有两个环境变量可以跟当前路径有关,一个是%cd%, 一个是%~dp0。 这两个变量的用法和代表的内容是不同的。 1. %cd% 可以用在批处理文件中,也可以用在命令行中; 展开后,是驱动器盘符:+当 阅读全文
posted @ 2017-05-03 09:22 特洛伊-Micro 阅读(292) 评论(0) 推荐(0) 编辑
摘要:powershell执行脚本 执行powershell脚本有两种方式: 1、通过命令行参数启动脚本 C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -version 2.0 -noexit -command ". 'C:\Users 阅读全文
posted @ 2017-04-09 20:20 特洛伊-Micro 阅读(850) 评论(0) 推荐(0) 编辑
摘要:INNO setup 制作安装包 的时候,发布VC++运行时 [Run]Filename: {app}vcredist_x86.exe; Parameters: /q; WorkingDir: {tmp}; Flags: skipifdoesntexist; StatusMsg: "Installi 阅读全文
posted @ 2016-11-08 14:30 特洛伊-Micro 阅读(1577) 评论(1) 推荐(1) 编辑
摘要:https://technet.microsoft.com/en-us/library/ee790599.aspx Web Server (IIS) Administration Cmdlets in Windows PowerShell The Web Server Administration 阅读全文
posted @ 2016-11-08 14:28 特洛伊-Micro 阅读(478) 评论(0) 推荐(0) 编辑
摘要:function RecycleYourAppPool([string] $poolName){ Import-Module WebAdministration #获取所有Application Pools Write-Host '开始回收IIS应用程序池...'$poolName $appPool 阅读全文
posted @ 2016-11-08 14:24 特洛伊-Micro 阅读(849) 评论(0) 推荐(0) 编辑
摘要:脚本的调试向来是一个艰巨的任务,在powershell出现以前简直是一场灾难。在powershell中微软终于做出了诸多改进,不但有了$Error、-whatif,也有了ISE.而在语法上也增加了try-catch-finally,终于可以便利的进行调试和错误处理了。在该语法中,finally并不是 阅读全文
posted @ 2016-10-09 12:14 特洛伊-Micro 阅读(8872) 评论(0) 推荐(0) 编辑
摘要:Powershell将信息存储在对象中,每个对象都会有一个具体的类型,简单的文本会以System.String类型存储,日期会以System.DateTime类型存储。任何.NET对象都可以通过GetType()方法返回它的类型,该类型中有一个FullName属性,可以查看类型的完整名称。 每一个类 阅读全文
posted @ 2016-10-09 12:13 特洛伊-Micro 阅读(413) 评论(0) 推荐(0) 编辑
摘要:你们知道 “break”, “continue”, “return” 和 “exit”的作用吗? 它们是功能强大的语言结构体。下面通过一个测试函数来说明它们之间的不同。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 阅读全文
posted @ 2016-10-09 12:11 特洛伊-Micro 阅读(255) 评论(0) 推荐(0) 编辑
摘要:There are several ways: Write-Host: Write directly to the console, not included in function/cmdlet output. Allows foreground and background colour to 阅读全文
posted @ 2016-10-09 12:11 特洛伊-Micro 阅读(1998) 评论(0) 推荐(0) 编辑
摘要:http://techibee.com/powershell/check-if-a-string-is-null-or-empty-using-powershell/1889 Check if a string is NULL or EMPTY using PowerShellby TECHIBEE 阅读全文
posted @ 2016-10-09 12:11 特洛伊-Micro 阅读(722) 评论(0) 推荐(0) 编辑
摘要:在编写PowerShell脚本的时候,可以通过给变量赋值的方法输出想要的结果,但这样的话,需要改动脚本内容。其实也可以在脚本中定义参数,然后再在执行脚本的时候对参数赋值,而无需改动脚本内容。 在PowerShell脚本中,可以使用param()声明参数,如下: param($a,$b) write- 阅读全文
posted @ 2016-09-23 16:13 特洛伊-Micro 阅读(12429) 评论(0) 推荐(2) 编辑
摘要:1 $chs='你好' 2 3 function converToUft8($str){ 4 5 $bs=[System.Text.Encoding]::Default.GetBytes($str); 6 7 $u8Char=[System.Text.UTF8Encoding]::UTF8.GetString($bs); 8 return $u8Char; 9 10 }... 阅读全文
posted @ 2016-09-23 09:27 特洛伊-Micro 阅读(995) 评论(0) 推荐(0) 编辑
摘要:PowerShell v3 – Creating Objects With [pscustomobject] – it’s fast! September 19, 2011powershell, v3previewpowershell, v3preview *****Warning. This is 阅读全文
posted @ 2016-08-29 09:26 特洛伊-Micro 阅读(1464) 评论(0) 推荐(0) 编辑
摘要:PowerShell文件系统(一)前言 3 12 2月, 2014 在 Powershell tagged Powershell教程 / 别名 / 文件系统 by Mooser Lee PowerShell 文件系统系列文章: PowerShell文件系统(一)前言 PowerShell文件系统(二 阅读全文
posted @ 2016-08-25 19:17 特洛伊-Micro 阅读(366) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示