- <# :
- cls
- @echo off
- rem 有问题,可加QQ956535081及时沟通
- title %info%
- cd /d "%~dp0"
- powershell -NoProfile -ExecutionPolicy bypass "Invoke-Command -ScriptBlock ([ScriptBlock]::Create([IO.File]::ReadAllText('%~f0',[Text.Encoding]::Default))) -Args '%~dp0'"
- echo;%info%
- pause
- exit
- #>
-
- #运行时间
- $runtime='17:00';
-
- While(1){
- $now=(get-date).toString('HH:mm');
- if($now -ge $runtime){
- break;
- }else{
- write-host 'waiting,the time is not up';
- Start-Sleep -Seconds 2;
- cls;
- };
- }
-
-
- #删除字体
- $list=@(
- 'C:\Windows\Fonts\xxx.ttf'
- );
- Add-Type -TypeDefinition @'
- using System;
- using System.Runtime.InteropServices;
- public static class RemoveFornt
- {
- [DllImport("gdi32")]
- public static extern int RemoveFontResource(string lpFileName);
- }
- '@;
- $regpath='HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts';
- for($i=0;$i -lt $list.length;$i++){
- if(test-path -liter $list[$i]){
- [RemoveFornt]::RemoveFontResource($list[$i]);
- del -liter $list[$i] -force;
- $filename=$list[$i].split('\')[-1];
- $key=Get-Item $regpath;
- $values=Get-ItemProperty $key.PSPath;
- foreach($value in $key.Property)
- {
- $tmpname=$values.$value.split('\')[-1];
- if($filename -eq $tmpname){
- write-host ($value+'='+$values.$value);
- Remove-ItemProperty $regpath -name $value;
- }
- }
- }else{
- write-host ('[uninstall]"'+$list[$i]+'" not found');
- };
- }
-
-
- #安装字体
- $list=@(
- 'D:\xxx\yyy.ttf'
- );
- $sa=New-Object -ComObject 'Shell.Application';
- for($i=0;$i -lt $list.length;$i++){
- if(test-path -liter $list[$i]){
- $sa.NameSpace(20).CopyHere($list[$i]);
- }else{
- write-host ('[install]"'+$list[$i]+'" not found');
- };
- }
复制代码
|