标题: [特效代码] 求助:bat如何实现从粘贴板读取内容并执行7zip参数命令 [打印本页]
作者: corr 时间: 2023-7-7 08:15 标题: 求助:bat如何实现从粘贴板读取内容并执行7zip参数命令
复制文件夹路径,然后bat命令可以自动读取该路径,并运行如下压缩命令对该路径下的文件进行压缩:- %ProgramFiles%\7-Zip\7z a -mx=9 -myx=9 -mmt=6 -ms=on -mtm=off -mtc=off -mta=off -mtr=off -m0=LZMA2:d=384m:fb=273:lc=3 -mmc=1000000000 路径.7z 路径\*
复制代码
其中的“路径”即是复制到粘贴板的内容。
请各位大侠赐教!
作者: Batcher 时间: 2023-7-7 09:13
回复 1# corr - @echo off
- cd /d "%~dp0"
- for /f "delims=" %%i in ('mshta "JavaScript:new ActiveXObject('Scripting.FileSystemObject').GetStandardStream(1).Write(clipboardData.getData('text'));close()"') do (
- set "StrClip=%%i"
- )
- "%ProgramFiles%\7-Zip\7z" a -mx=9 -myx=9 -mmt=6 -ms=on -mtm=off -mtc=off -mta=off -mtr=off -m0=LZMA2:d=384m:fb=273:lc=3 -mmc=1000000000 路径.7z "%StrClip%\*"
复制代码
作者: corr 时间: 2023-7-7 10:18
大侠威武!
@echo off
cd /d "%~dp0"
for /f "delims=" %%i in ('mshta "JavaScript:new ActiveXObject('Scripting.FileSystemObject').GetStandardStream(1).Write(clipboardData.getData('text'));close()"') do (set "StrClip=%%i")
"%ProgramFiles%\7-Zip\7z" a -mx=9 -myx=9 -mmt=6 -ms=on -mtm=off -mtc=off -mta=off -mtr=off -m0=LZMA2:d=384m:fb=273:lc=3 -mmc=1000000000 "%StrClip%.7z" "%StrClip%\*"
完美!
欢迎光临 批处理之家 (http://bbs.bathome.net/) |
Powered by Discuz! 7.2 |