当我下载.tar.gz文件时,我先用两个命令打开它gunzip,然后再打开它tar.
是否可以只用一个命令打开它?
我目前正在Powershell中编写一个脚本,允许将SVN存储库中的文件夹复制到另一个文件夹,同时保留历史记录.这种命令的一个例子是:
svnadmin.exe dump $FromRepoPath `
| svndumpfilter.exe include --drop-empty-revs --renumber-revs --preserve-revprops $Folder `
| svnadmin.exe load --ignore-uuid $ToRepoPath
Run Code Online (Sandbox Code Playgroud)
这会在Powershell中导致非常高的内存使用量.似乎Powershell首先执行svnadmin.exe并从SVN admin缓冲stdout,然后执行svndumpfilter并缓冲输出并最终执行svnadmin.exe.
我可以通过创建一个单独的批处理文件来解决它:
@echo off
svnadmin.exe dump %1 | svndumpfilter.exe include --drop-empty-revs --renumber-revs --preserve-revprops %2 | svnadmin.exe load --ignore-uuid %3
Run Code Online (Sandbox Code Playgroud)
然后从Powershell调用它:
cmd.exe /c "SvnHelper.cmd $FromRepoPath $Folder $ToRepoPath"
Run Code Online (Sandbox Code Playgroud)
但这感觉就像一个讨厌和不必要的解决方法.
有没有办法告诉Powershell在管道而不是缓冲时直接传递?