关于powershell:Windows中查找出所有损坏的音频文件

要在Windows中查找所有损坏的音频文件,你能够应用PowerShell和FFmpeg。首先,确保你曾经装置了FFmpeg。而后,能够应用以下PowerShell脚本来扫描文件并查看它们的完整性: # 设置要搜寻的目录门路$directoryToSearch = "C:\Path\To\Your\Directory"# 应用Get-ChildItem查找所有音频文件(能够依据须要增加更多的文件扩展名)$audioFiles = Get-ChildItem -Path $directoryToSearch -File -Include *.mp3, *.flac, *.aac, *.m4a -Recurse# 遍历每个音频文件并查看完整性foreach ($file in $audioFiles) { # 应用FFmpeg命令查看文件 $result = ffmpeg -v error -i "$($file.FullName)" -f null - # 如果输入中蕴含"error"或"corrupt"则认为文件损坏 if ($result -match "error|corrupt") { Write-Host "损坏的音频文件: $($file.FullName)" }}Write-Host "扫描实现。"在上述脚本中: 替换 $directoryToSearch 变量为你要搜寻的目录门路。应用 Get-ChildItem 命令查找指定目录下的音频文件(能够依据须要增加更多的文件扩展名)。遍历每个音频文件,应用 ffmpeg 命令查看其完整性。如果输入中蕴含 "error" 或 "corrupt" 字样,则认为文件损坏,并在终端中显示文件门路。运行此PowerShell脚本后,它将扫描指定目录及其子目录中的音频文件,并显示任何损坏的文件的门路。请确保替换 $directoryToSearch 为你要搜寻的目录的理论门路。

September 27, 2023 · 1 min · jiezi

关于powershell:powershell配置utf8编码

长期批改为utf-8PS> chcp 65001通过配置文件永恒批改查看powershell配置文件地位,如果不存在则去创立 PS> $PROFILE在配置文件中写入 $OutputEncoding = [console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding从新关上Powershell 如果呈现报错如下 . : 无奈加载文件 C:\Users\***\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1,因为在此零碎上禁止运行脚本。无关详细信息,请参阅 https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies。所在位置 行:1 字符: 3+ . 'C:\Users\gong\Documents\WindowsPowerShell\Microsoft.PowerShell_pro ...+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : SecurityError: (:) [],PSSecurityException + FullyQualifiedErrorId : UnauthorizedAccess则应用管理员权限关上Powershell 执行命令如下,配置容许零碎运行脚本,该配置默认是Restricted,默认禁止的 PS> Set-ExecutionPolicy RemoteSigned执行命令如下确认批改失效 PS> Get-ExecutionPolicy从新关上powershell输出命令chcp,如果输入如下示意批改胜利 Active code page: 65001输入重定向到文件时配置编码在Powershell能够应用输入重定向,如下把ls命令重定向到文件aa.txt PS> ls > aa.txt之后应用记事本关上aa.txt,能够在右下角看到编码显示为UTF-16 LE 应用utf8重定向如下 PS> ls | out-file bb.txt -encoding utf8用记事本关上bb.txt,看到编码显示带BOM的UTF-8 参考浏览解决PowerShell中文乱码 microsoft 编码 microsoft输入重定向

July 12, 2023 · 1 min · jiezi

关于powershell:Y-分钟速成-powershell

源代码下载: LearnPowershell-cn.ps1 PowerShell 是 Windows 平台下的脚本语言同时也是配置管理框架,它是建设在微软 .Net Framework 之上,Windows 7 以及之后版本都内置 Poweshell。上面的示例中都是 PoweShell 脚本的一部分或者间接可能在 Shell 交互窗口中执行。 与 Bash 最大的不同是你大部分操作的货色是对象而不是一般的文本。 延长浏览 如果你不确定你的环境,执行如下操作: Get-ExecutionPolicy -ListSet-ExecutionPolicy AllSigned# Execution Policy 蕴含以下:# - Restricted: 不会运行脚本。# - RemoteSigned: 只会运行受信赖的发行商下载的脚本。# - AllSigned: 运行须要被信赖发行商签名的脚本。# - Unrestricted: 运行所有脚本help about_Execution_Policies # 查看更多信息# 以后 PowerShell 版本$PSVersionTable获取帮忙 # 查找命令Get-Command about_* # 别名: gcmGet-Command -Verb AddGet-Alias psGet-Alias -Definition Get-ProcessGet-Help ps | less # 别名: helpps | Get-Member # 别名: gmShow-Command Get-EventLog # GUI 填充参数Update-Help # 管理员运行接下来是教程 ...

December 19, 2022 · 4 min · jiezi

关于powershell:在windows的powershell里如何输入输出重定向

问题在windows pwsh里输入输出重定向的语法是什么? 在Linux里咱们应用以下命令: $ ./program < input.txt > output.txt如果我想在windows里达到雷同的目标, 我须要应用什么指令? 答复在windows上你不能间接把文件挂载到规范输出(stdin)里, 然而仍有其余的办法 PS > Get-Content input.txt | ./program > output.txt验证这里有一个非常简单的程序, 它单纯从规范输出流里获取数据, 而后输入到规范输入流里 // demo.cpp#include <iostream>int main(int argc, char const *argv[]){ int data; while (std::cin >> data) { std::cout << data << std::endl; } return 0;}↓ input.txt ↓ 其中EOF代表输出截至, 起的成果和ctrl + z一样 123EOF将其编译成为可执行文件demo.exe PS > get-content .\input.txt | .\demo01.exe > output.txt执行完后↓ output.txt ↓ 123的确无效! get-content会获取input.txt文件的内容, 而后通过管道流传给demo01.exe 事实上如果你的PC上有git bash也能够很不便的像linux一样输入输出重定向 留神: 如果你应用的是CMD, 则下面的指令是有效的, 该命令只能会在powershell中失效, 另外, 不要把PS > 也复制进去了! ...

November 26, 2022 · 1 min · jiezi

关于powershell:win11中的终端美化

win11(windows terminal)+powershell 7 + oh-my-posh 丑化终端卸载老版的 windows terminal去微软装置最新的 windows terminal配置 windows terminal JSON 文件{ ... "profiles": { // todo 用上面这个defaults笼罩原文件中的defaults这一项 "defaults": { // 这个背景图片本人上电脑找张喜爱的图而后复制门路过去,留神斜杠反过来 "backgroundImage": "C:/Users/Administrator/Pictures/1.jpg", "backgroundImageOpacity": 0.1, "font": { // 这是应用的字体,可自定义,我喜爱用JetBrainsMono Nerd Font Mono "face": "JetBrainsMono Nerd Font Mono" }, "opacity": 95, "useAcrylic": true },}装置字体https://wsxl.lanzouw.com/iOoE... 明码:1dk7在微软装置 winget用 winget 装置 oh-my-poshwinget install JanDeDobbeleer.OhMyPosh配置关上配置文件:code $PROFILE其中 montys.omp.json 是主题文件 将上面这一段复制到文件中oh-my-posh init pwsh --config $env:POSH_THEMES_PATH\montys.omp.json | Invoke-Expressioncls更多主题抉择C:\Users\Administrator\AppData\Local\Programs\oh-my-posh\themes我的主题material.omp.jsonamro.omp.json// 正在用emodipt.omp.jsonneko.omp.json :好玩,猫头像其它报错因为在此零碎上禁止运行脚本。无关详细信息,请参阅 https:/go.microsoft.com/fwlink/?LinkID=135170 中的解决办法get-executionpolicy# 设置执行策略Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

October 15, 2022 · 1 min · jiezi

关于powershell:PowerShell

PowerShell replace()作用:替换一个串中的一些字符语法: .Replace(_strOldChar_, _strNewChar_)例子:1.用一个串替换另一个串 "abcdef" -replace "dEf","xyz" #把串"abcdef"中的"dEf"替换为xyz。疏忽大小写。$demo = "abcdef" #定义变量demo$demo.replace("dEf","xyz") #将变量demo中的dEf替换为xyz"abcdef" -replace "dEf","xyz" -replace "cx","-"ab-yz #把串"abcdef"中的"dEf"替换为xyz,再将cx替换为-poweshell相干命令学习Get-Content获取某个地位的对象的内容,输入在显示屏上。 1..100 | ForEach-Object { Add-Content -Path .\LineNumbers.txt -Value "This is line $_." }Get-Content -Path .\LineNumbers.txt1..100:代表数组1~100ForEach-Object:对每个对象执行操作Add-Content:$_:是一个变量,代表数组的每个值,它通过管道发送的。Set-Content向一个文件中写一些内容,或者替换一些内容。能够通过Value参数和管道向Set-Content发送内容。Write-Host输入用的 Start-Process在本地机器关上一个过程。默认的,此过程会继承以后过程的所有环境变量。 Start-Process -FilePath "sort.exe" #在以后门路中,用sort.exe文件关上一个过程。New-Item在文件系统中,它创立一个文件或者目录。它能够创立一个全新的文件,也能够向文件中减少额定的内容。 New-Item -Path . -Name "testfile1.txt" -ItemType "file" -Value "This is a text string." #创立一个文件。 . 代表当前目录。-Value参数值是向文件中增加的内容。New-Item -ItemType "file" -Path ".\testfile1.txt" -Value "This is a text string." #同上New-Item -Path "c:\" -Name "logfiles" -ItemType "directory" #创立一个目录。loggiles是目录的名字New-Item -ItemType "directory" -Path "c:\logfiles" #同上Copy-Item从一个地位到另一个地位复制内容(文件或者文件夹)。默认地,它会继承以后过程的所有环境变量。Invoke-Command ...

May 10, 2022 · 1 min · jiezi

关于powershell:Powershell-Windows-Terminal最简单的美化

网上一大堆丑化教程,啰里啰唆,还讲不清,并且一堆谬误 第一步装置模块powershell 管理员身份运行,并执行以下。 ##容许执行脚本set-executionpolicy remotesignedInstall-module PSReadlineInstall-Module posh-gitInstall-Module oh-my-poshInstall-Module DirColors第二步 导入模块Import-Module PSReadlineImport-Module DirColorsImport-Module posh-gitImport-Module oh-my-poshSet-PoshPrompt -Theme powerLine但此时,只利用到以后,下次关上还是老样子,这样,咱们就给加个配置文件 第三步 配置首先记事本关上notepad $profile接着输出如下内容并保留 Import-Module PSReadlineImport-Module DirColorsImport-Module posh-gitImport-Module oh-my-poshSet-PoshPrompt -Theme powerLine第四步 装置个难看的字体装置字体是必须的,否则可能呈现乱码。这里既然用的Theme powerLine,那咱们就下powerLine字体powerline/fonts: Patched fonts for Powerline users. (github.com)下载当前,找到DejaVu Sans Mono for Powerline.ttf装置并在windows terminal设置里设置好该字体 第五步 给windows terminal选个适合的配色在Terminal的配置json文件中插入"colorScheme": "One Half Dark", 间接窗口抉择也能够 我的成品,是不是难看多了!

November 2, 2021 · 1 min · jiezi

关于powershell:powershell-按F7展开搜索历史记录

Install-Module Microsoft.PowerShell.ConsoleGuiToolscode $profile增加一下代码 # 按f7显示历史记录function ocgv_history { $line = $null $cursor = $null [Microsoft.PowerShell.PSConsoleReadLine]::GetBufferState([ref]$line, [ref]$cursor) $selection = $input | Out-ConsoleGridView -Title "Select CommandLine from History" -OutputMode Single -Filter $line if ($selection) { [Microsoft.PowerShell.PSConsoleReadLine]::DeleteLine() [Microsoft.PowerShell.PSConsoleReadLine]::Insert($selection) if ($selection.StartsWith($line)) { [Microsoft.PowerShell.PSConsoleReadLine]::SetCursorPosition($cursor) } else { [Microsoft.PowerShell.PSConsoleReadLine]::SetCursorPosition($selection.Length) } }}$parameters = @{ Key = 'F7' BriefDescription = 'ShowMatchingHistoryOcgv' LongDescription = 'Show Matching History using Out-ConsoleGridView' ScriptBlock = { param($key, $arg) # The arguments are ignored in this example Get-History | Sort-Object -Descending -Property Id -Unique | Select-Object CommandLine -ExpandProperty CommandLine | ocgv_history }}Set-PSReadLineKeyHandler @parameters$parameters = @{ Key = 'Shift-F7' BriefDescription = 'ShowMatchingGlobalHistoryOcgv' LongDescription = 'Show Matching History for all PowerShell instances using Out-ConsoleGridView' ScriptBlock = { param($key, $arg) # The arguments are ignored in this example $hist = [Microsoft.PowerShell.PSConsoleReadLine]::GetHistoryItems().CommandLine # reverse the items so most recent is on top [array]::Reverse($hist) $hist | Select-Object -Unique -First 1000 | ocgv_history }}Set-PSReadLineKeyHandler @parameters

September 3, 2021 · 1 min · jiezi

关于powershell:Powershell命令收集

先记录后,后整顿获取所有的磁盘符号: PS> $ [Environment]::GetLogicalDrives()获取所有的磁盘信息(powershell version 1): PS> $ Get-WmiObject -Class win32_logicaldiskRefs: powershell获取磁盘信息获取所有的磁盘信息(powershell version 6): PS> $ Get-CimInstance win32_logicaldiskRefs: What Library for Powershell 6 contains the get-wmiobject command?

August 31, 2021 · 1 min · jiezi

关于powershell:Windows-下配置-pproxy-开机启动qbit

环境本文对 Windows 10/2019 实用Python 版本 3.8.2pproxy 版本: 2.7.8步骤装置 pproxy pip3 install pproxy工作打算程序 -> 创立根本工作输出工作名!触发器设置为“计算机启动时”操作设置为“启动程序”配置启动程序和参数 cmd.exe /k start /b pproxy -l http+socks5://:8081/# ORpowershell.exe -windowstyle hidden pproxy -l http+socks5://:8081/ 勾选图示复选框,点击实现勾选图示的单选框,复选框是否勾选视具体情况,点击确定重启验证本文出自 qbit snap

July 12, 2021 · 1 min · jiezi

关于powershell:奇怪的-Powershell

本文用来收集一些应用 Powershell 的时候的一些奇奇怪怪的体验。 0x00 :: 生存还是覆灭?在操作 汇合 (比方 数组 、 链表 、 哈希映射表 等)的时候,有一种叫 算子 的概念。 在 Scala 里它实质上是一些对象的办法,一些语言里它被叫做「高级函数」。 这里次要须要先晓得这俩: map : 对 汇合 里的每一个 元素 ,都指定一个计算的逻辑,该 算子 能够返回一个新的 汇合 ,外面每个 元素 都是上一个汇合每个 元素 通过该逻辑后的值。 比方: {2,3,3} 这个汇合,通过 map(你们每个都乘以3) 解决后,就能返回 {6,9,9} 这样的汇合。flatten : 把一个 汇合 里,若有的 元素 也是 汇合 ,那么该 算子 会返回一个突破一层外面汇合的新汇合。 比方: {{1,2},7,{2,3,3},{2,{6,6,6},12},4} 这个汇合,通过 flatten 解决后,返回的汇合就是 {1,2,7,2,3,3,2,{6,6,6},12,4} 这样的。flatmap : 其实, flatmap(xxx) 就等同于先 map(xxx) 而后 flatten 。 比方:如果,汇合乘法成果是这样:{1,2,3} * 2 => {1,2,3,1,2,3} ,那么, {{1,2},7,{{2,3,3}}} 通过 flatmap(每个元素给我乘2) 后,就等于先被变成 {{1,2,1,2},14,{{2,3,3},{2,3,3}}} 这样,再变成 {1,2,1,2,14,{2,3,3},{2,3,3}} 这样。 ...

June 24, 2021 · 2 min · jiezi

关于powershell:Windows-使用-PowerShell-来管理另外一台-Windows-机器

远程管理是通过 WinRM 来实现的,这个和 Windows remote desktop 是有所不同的。 Windows remote desktop 是传统的远程桌面拜访形式,你能够通过远程桌面来拜访一台近程的 Windows 机器。 对个别的应用来说基本上是够了。然而一些比拟底层的命令执行来说,可能你须要一些其余的工具,这个就是和咱们近程到 Linux 上主机的意思是一样的。 WinRM 是什么 依据 WinRM SDK (msdn2.microsoft.com/aa384426),Windows 远程管理是“WS 治理协定的 Microsoft 施行,该协定是基于规范 SOAP、不受防火墙影响的协定,容许不同供应商的硬件和操作系统互相操作。”Java Specification Request 262(Web Services Connector for JMX Agent)承诺要与基于 Windows 的、WS-Management 服务间接交互。 WinRM 可用于 Windows Server® 2003 R2、Windows Vista® 和 Windows Server 2008,而且 WinRM 使您能够通过 Internet 治理计算机。WinRM 应用端口 80 实现此操作,端口 80 是一种规范的 Internet 服务端口,大多数防火墙都关上此端口(不过,可依据须要更改 WinRM 和默认传输机制 HTTP 应用的端口)。 简略来说 WinRM 是应用 HTTP 协定的,协定的端口是:5985。 ...

June 12, 2021 · 1 min · jiezi

关于powershell:Windows-PowerShell-ISE-是什么和-PowerShell-有什么区别

最近因为我的项目的须要,开始接触到了 Windows PowerShell ISE 这个软件。 其实最开始的了解就是 PowerShell 的升级版,真正用过 PowerShell 的童鞋对在 PowerShell 中进行编辑命令应该是十分头痛的。 Windows PowerShell ISE 能够了解为在一个记事本中减少了 PowerShell 的性能,能够在记事本中进行的操作在 PowerShell ISE 基本上都能够进行。 最最不便的应该就是命令行抉择和删除字符后运行了。 PowerShell ISE 是什么 Windows PowerShell 集成脚本环境 (ISE) 是 Windows PowerShell 的主机应用程序。在 Windows PowerShell ISE 中,能够在繁多 Windows 图形用户界面中运行命令以及编写、测试和调试脚本,该用户界面具备多行编辑、Tab 补齐、语法着色、选择性执行、上下文相干帮忙等性能,而且还反对从右到左书写语言。 此主机应用程序最多还能够包含八个会话。 能够自定义 Windows PowerShell ISE 的外观。Windows PowerShell ISE 还有本人的 Windows PowerShell 配置文件,您能够在其中存储在 Windows PowerShell ISE 中应用的函数、别名、变量和命令。 运行 能够在 Windows 10 中的搜寻中,搜寻 PowerShell 。 而后将光标在左侧挪动,抉择 Windows PowerShell,在由此的扩大窗口中,能够看到有 ISE 的选项。 你能够以管理员的身份来运行,你也能够间接运行 ISE。 ...

June 12, 2021 · 1 min · jiezi

关于powershell:Powershell-快捷键

Powershell的快捷键和cmd,linux中的shell,都比拟像。 ALT+F7 革除命令的历史记录PgUp PgDn 显示以后会话的第一个命令和最初一个命令Enter 执行以后命令End 将光标移至以后命令的开端Del 从右开始删除输出的命令字符Esc 清空以后命令行F2 主动补充历史命令至指定字符(例如历史记录中存在Get-Process,按F2,提醒"Enter char to copy up to",键入‘s’,主动补齐命令:Get-Proce)F4 删除命令行至光标左边指定字符处F7 对话框显示命令行历史记录F8 检索蕴含指定字符的命令行历史记录F9 依据命令行的历史记录编号抉择命令,历史记录编号能够通过F7查看左/右方向键 左右挪动光标上/下方向键 切换命令行的历史记录Home 光标移至命令行最左端Backspace 从右删除命令行字符Ctrl+C 勾销正在执行的命令Ctrl+左/右方向键 在单词之间挪动光标Ctrl+Home 删除光标最左端的所有字符Tab 主动补齐命令或者文件名

December 17, 2020 · 1 min · jiezi

关于powershell:powershell-看一个一个命令的目录

git-command

August 14, 2020 · 1 min · jiezi