-----------------------------代码-------------
- @echo off
- :run
- Set/p a=按a安装脚本,按d卸载脚本:
- if /i "%a%"=="a" Goto,setup
- if /i "%a%"=="d" Reg delete "HKEY_CLASSES_ROOT\Directory\Background\Shell\Screensho" /f & del /q %windir%\Screenshot.Vbs & Echo.注册表已经卸载,脚本已经删除!& Pause > Nul & Exit
- cls & Goto,run
- :setup
- (Echo.Do:s=s+1:f="C:\Users\Administrator\Desktop"^&Date^(^)^&"_"^&Hour^(time^)^&"-"^&Minute^(time^)^&"-"^&Second^(time^)^&"_"^&s^&".png":If Not CreateObject^("Scripting.FileSystemObject"^).FileExists^(f^) Then Exit Do
- Echo.Loop:CreateObject^("WScript.Shell"^).run "PowerShell -C Add-Type -AssemblyName System.Windows.Forms;Add-Type -AssemblyName System.Drawing;$S=[System.Windows.Forms.SystemInformation]::VirtualScreen;$B=New-Object System.Drawing.Bitmap $S.Width, $S.Height;$G=[System.Drawing.Graphics]::FromImage($B);$G.CopyFromScreen($S.Left, $S.Top, 0, 0, $B.Size);$B.Save('"^&f^&"');",0)>%windir%\Screenshot.Vbs
- Reg add "HKEY_CLASSES_ROOT\Directory\Background\Shell\Screenshot" /v "MUIVerb" /t REG_SZ /d "截屏到桌面" /f
- Reg add "HKEY_CLASSES_ROOT\Directory\Background\Shell\Screenshot" /v "icon" /t REG_SZ /d "%Windir%\System32\Shell32.dll,240" /f
- Reg add "HKEY_CLASSES_ROOT\Directory\Background\Shell\Screenshot\command" /t REG_SZ /d "WScript.exe %windir%\Screenshot.vbs" /f
- Echo.右键【桌面截屏】VBS版 & Echo.安装完毕!& Pause >Nul & Exit
复制代码
-------代码存 ANSI 编码 ,XXXX.BAT-------24K 纯代码--只在WIN10编写使用,理论上有 PowerShell 的系统都支持
BAT 生成 VBS 文件,%windir%\Screenshot.vbs,,,,,,
计算文件数目,运行PS 命令,保存 (年-月-日_时-分-秒_数.png)文件,
f="C:\Users\Administrator\Desktop\" 是保存位置,遇重则返回运算,,,,
很早之前就写了,自用了好久,,,从我的“批处理工具箱”里扣出来发表的,,,
安装提示复制昨天发表的,发现昨天写漏了%a%,,年级大了,偶有疏忽,,
|