[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
  1. <# :
  2. cls
  3. @echo off
  4. rem 有问题,可加QQ956535081及时沟通
  5. title %info%
  6. cd /d "%~dp0"
  7. powershell -NoProfile -ExecutionPolicy bypass "Invoke-Command -ScriptBlock ([ScriptBlock]::Create([IO.File]::ReadAllText('%~f0',[Text.Encoding]::Default))) -Args '%~dp0'"
  8. echo;%info%
  9. pause
  10. exit
  11. #>
  12. #运行时间
  13. $runtime='17:00';
  14. While(1){
  15. $now=(get-date).toString('HH:mm');
  16.     if($now -ge $runtime){
  17.         break;
  18.     }else{
  19.         write-host 'waiting,the time is not up';
  20.         Start-Sleep -Seconds 2;
  21.         cls;
  22.     };
  23. }
  24. #删除字体
  25. $list=@(
  26.     'C:\Windows\Fonts\xxx.ttf'
  27. );
  28. Add-Type -TypeDefinition @'
  29.     using System;
  30.     using System.Runtime.InteropServices;
  31.     public static class RemoveFornt
  32.     {
  33.         [DllImport("gdi32")]
  34.         public static extern int RemoveFontResource(string lpFileName);
  35.     }
  36. '@;
  37. $regpath='HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts';
  38. for($i=0;$i -lt $list.length;$i++){
  39.     if(test-path -liter $list[$i]){
  40.         [RemoveFornt]::RemoveFontResource($list[$i]);
  41.         del -liter $list[$i] -force;
  42.         $filename=$list[$i].split('\')[-1];
  43.         $key=Get-Item $regpath;
  44.         $values=Get-ItemProperty $key.PSPath;
  45.         foreach($value in $key.Property)
  46.         {
  47.            $tmpname=$values.$value.split('\')[-1];
  48.            if($filename -eq $tmpname){
  49.                 write-host ($value+'='+$values.$value);
  50.                 Remove-ItemProperty $regpath -name $value;
  51.            }
  52.         }
  53.     }else{
  54.         write-host ('[uninstall]"'+$list[$i]+'" not found');
  55.     };
  56. }
  57. #安装字体
  58. $list=@(
  59.     'D:\xxx\yyy.ttf'
  60. );
  61. $sa=New-Object -ComObject 'Shell.Application';
  62. for($i=0;$i -lt $list.length;$i++){
  63.     if(test-path -liter $list[$i]){
  64.         $sa.NameSpace(20).CopyHere($list[$i]);
  65.     }else{
  66.         write-host ('[install]"'+$list[$i]+'" not found');
  67.     };
  68. }
复制代码
提供bat代写
QQ: 956535081

TOP

返回列表