Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Powershell移动项目日志记录_Powershell - Fatal编程技术网

Powershell移动项目日志记录

Powershell移动项目日志记录,powershell,Powershell,我想得到一些帮助,使powershell脚本正常工作。下面贴着一块。基本上,我要做的是将不同子目录中的所有文件移动到另一个位置。我可以移动文件,创建文件夹,但我只是在将结果放入文本文件时遇到了问题。我尝试使用out文件,但txt文件是空的。我也试过开始抄本,但记事本似乎看不到换行和所有文本一起流血。有没有更好的办法?我使用这个基本命令进行测试 Start-Transcript c:\log.txt Move-Item c:\temp\*.* C:\Temp\2014 -Verbose -Forc

我想得到一些帮助,使powershell脚本正常工作。下面贴着一块。基本上,我要做的是将不同子目录中的所有文件移动到另一个位置。我可以移动文件,创建文件夹,但我只是在将结果放入文本文件时遇到了问题。我尝试使用out文件,但txt文件是空的。我也试过开始抄本,但记事本似乎看不到换行和所有文本一起流血。有没有更好的办法?我使用这个基本命令进行测试

Start-Transcript c:\log.txt
Move-Item c:\temp\*.* C:\Temp\2014 -Verbose -Force
Stop-Transcript

您可能只需要折叠输出文件描述符。根据该页面,如果您执行以下操作,它应该可以工作:

Move-Item c:\temp\*.* C:\Temp\2014 -Verbose -Force *>&1 | 
    Out-File -FilePath $MyLogPath
或者如果您希望同时看到输出

Move-Item c:\temp\*.* C:\Temp\2014 -Verbose -Force *>&1 |
    Tee-File -FilePath $MyLogPath