谁能给我解释一下,如何在森林中有一个相对的路径?我想在每个找到的文件上执行这些语句。
Get-ChildItem C:\Entw\test*.txt | ForEach-Object {
$dt=[System.IO.File]::GetCreationTime("C:\test\test.txt")
$dt2=New-TimeSpan -Minutes 60
$dt=$dt-$dt2
[System.IO.File]::SetCreationTime("C:\test\test.txt", $dt)
[System.IO.File]::SetLastWriteTime("C:\test\test.txt", $dt)
}test.txt应该是相对的,甚至是路径。
发布于 2019-07-29 15:54:46
添加相对路径并对找到的每个文件执行语句(在我的例子中更改文件的元数据
$directorypath=get-location
echo $directorypath
foreach ($file in Get-ChildItem $directorypath\*.txt){
#do something
}https://stackoverflow.com/questions/57249013
复制相似问题