powershell some check
// TODO 待处理
1 # powershell 编写的某些校验 2 3 function listChecks() { 4 write-host '可用的校验'; 5 write-host 'CRC - 循环冗余校验'; 6 return '-- done'; 7 } 8 9 # 字节数组 CRC, 不知道是不是符合CRC定义 10 function crcCheck($byteArray) { 11 if ($byteArray -eq $null) { 12 return 'crc - Null param.'; 13 } 14 15 $result = 0xFFFF; 16 17 for ($i = 0; $i -lt $byteArray.length; $i++ ) { 18 $result = $result -bxor $byteArray[$i]; 19 20 for ($j = 0; $j -lt 8; $j++) { 21 if (($result % 2) -eq 1) { 22 $result = [System.Decimal]::ToInt32($result / 2); 23 $result = 0xA001 -bxor $result 24 } else { 25 $result = [System.Decimal]::ToInt32($result / 2); 26 } 27 } 28 } 29 30 $crch = [System.Decimal]::ToInt32($result / 256); 31 $crcl = $result % 256; 32 return [System.String]::Format("High, Low = {0}, {1}", $crch.toString("X2"), $crcl.toString("X2")); 33 } 34 35 # 脚本 36 # args[1] : byte array 37 switch($args[0]) { 38 {$_ -eq 'crc'} {crcCheck $args[1] | write-host ; break} 39 default {write-host "没有与 [" $args[0] "] 相关的实现" ; break} 40 }
--------------
转载于:https://www.cnblogs.com/shadow-abyss/p/11119770.html
powershell some check相关推荐
- 如何在PowerShell中使用带有空格和引号的参数运行EXE文件
本文翻译自:How to run an EXE file in PowerShell with parameters with spaces and quotes How do you run the ...
- How to Install Snapd and Snap applications on CentOS 7
转载来源:https://computingforgeeks.com/install-snapd-snap-applications-centos-7/ How to Install Snapd an ...
- SQL Server数据库迁移最佳实践,可降低风险和停机时间
介绍 (Introduction) The main goal of many organizations, today, is reducing costs while maintaining th ...
- [转]Windows Notes And Cheatsheet
原文:https://github.com/m0chan/m0chan.github.io/blob/master/_posts/2019-07-30-Windows-Notes-and-Cheats ...
- oracle 提取当天日志,powershell提取日志内容
写了一个powershell提取日志内容的脚本,搜索oracle关于ORA的报错信息 #查找结果赋值 $d=Get-ChildItem c:\test -Recurse | where{" ...
- Python Module_subprocess_调用 Powershell
目录 目录 前言 Powershell call Python Python call Powershell Powershell发送邮件 最后 前言 使用Python内建的subprocess模块, ...
- PowerShell批量设置PATH环境变量
PowerShell批量设置PATH环境变量 Code #requires -version 4.0 #requires #-runasadministrator# Get the ID and se ...
- check_mk自定义监控实践之powershell
最近在学习check_mk,这是一款基于nagios监控工具,但比nagios更易使用,引起了我的兴趣,我最关注的依然是对自定义监控脚本的支持度.在windows下的实践,其支持的客户端脚本或插件可以 ...
- PowerShell Core 6.2 发布,侧重于性能改进
百度智能云 云生态狂欢季 热门云产品1折起>>> PowerShell Core 6.2 GA 已发布,PowerShell Core 是 PowerShell 的开源版本,适用 ...
最新文章
- 你不知道的z-index
- opencv openpose
- 【控制】《鲁棒控制-线性矩阵不等式处理方法》-俞立老师-第3章-系统性能分析
- 基于heartbeat v1+ldirectord实现LVS的高可用
- 【caffe-Windows】caffe+VS2013+Windows无GPU快速配置教程
- 地理信息考c语言,南师地理信息系统专业01方向真题C语言
- 深圳信息职业技术学校 计算机辅助设计和制造,大学生职业生涯规划书样稿.doc...
- 雅虎Yahoo 前段优化 14条军规
- php重载求圆锥体积,编写一函数文件,实现求一个圆锥体的体积。
- 中台搞了2年,项目叫停,CIO被裁!本以为中台是道送分题,没想到是送命题!...
- arr和arr的区别以及数组首元素地址和整个数组地址的区别
- 【String字符串分割以及字符串截取】
- js项目中常见util方法
- 移动新魔百盒M411A_905L3_5621_语音免拆_卡刷固件包
- 华为云点学堂为你揭开DevOps转型的秘密
- r510服务器开机无显示,联想B320i开机无显示维修案例
- css3小狗滑滑梯动画js特效
- rosbag录制问题:/use_sim_time set to true and no clock published. Still waiting for valid time...
- 动物实验可用计算机模拟,《动物实验类试题》.doc
- 第4章:色彩空间类型转换