小编ral*_*004的帖子

Powershell - if 和 testpath 不带逻辑

我的代码是这样的:

If (Test-Path c:\temp\mysunnyday)
{
    New-Item c:\temp\mysunnyday -ItemType directory
}
Set-Location c:\temp\mypodcast
Run Code Online (Sandbox Code Playgroud)

我想说IF NOT TRUE。我怎样才能做到这一点?我读了这篇文章

http://www.computerperformance.co.uk/powershell/powershell_if_not.htm#Example_2:_PowerShell_If_-Not_Logic

我尝试过-ne ! -not

但没有任何效果。有人能帮我吗?

powershell if-statement

3
推荐指数
1
解决办法
3260
查看次数

标签 统计

if-statement ×1

powershell ×1