0x0*_*01E 1 powershell if-statement
我正在尝试执行以下操作:
src
dstdst,则继续dst,请执行某些操作我正在努力理解嵌套的 IF 语句应该如何构建
鉴于您的要求,这似乎很直接:
$src = "e:\temp"
$dst = "e:\temp2"
$filename = "test.txt"
# 1.Check for a file in src
if (Test-Path "$src\$filename")
{
# 1.A If that file is there copy it to dst
Copy-Item "$src\$filename" $dst
if (!(Test-Path "$dst\$filename"))
{
# 1.C If that file isn't in the dst do something
}
#1.B If that file exists in the dst continue
}
else
{
#2.Continue on but do something else
}
#3.Finish off and do something else
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
19297 次 |
| 最近记录: |