压缩批处理脚本中的文件



我需要将文件压缩到gunzip中,这是通过以下命令完成的

@回波关闭gzip-c c:\temp1\xx.out>c:\temp2\x2.out.gz

但我的请求是检查一个扩展名为.out的目录中的所有文件,并将每个文件压缩到gunzip文件中,压缩完成后删除同一个文件。请告诉我如何在批处理脚本

中完成
   rem Pick up each file in C:Temp1 with .out extension.
   for %%a in ("C:temp1*.out") do (
        rem Compress the file to a file with the same name but .gz extension is added.
        gzip -c %%a > %%a.gz
        rem Delete the .out file which has been already compressed.
        del /F /Q %%a
    )

最新更新