相关疑难解决方法(0)

使用单个命令打开.tar.gz文件

当我下载.tar.gz文件时,我先用两个命令打开它gunzip,然后再打开它tar.

是否可以只用一个命令打开它?

linux gzip tar gunzip

36
推荐指数
2
解决办法
5万
查看次数

Powershell管道会导致爆炸性内存使用

我目前正在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在管道而不是缓冲时直接传递?

powershell batch-file

6
推荐指数
1
解决办法
1023
查看次数

标签 统计

batch-file ×1

gunzip ×1

gzip ×1

linux ×1

powershell ×1

tar ×1