Robert
Robert

Reputation: 1180

PowerShell Test Path returns false but should be true

At the start of my PowerShell I have it checking a network location to determine if there is a newer version than the current one. However, it will only return true if I had previously browsed to the network location. Any suggestions, I thought about mapping a drive and then removing the drive location but I think that is a bit extreme.

$update=Test-Path "\\server\mylocation\Technology\Shared%20Documents\program\XXXXX.zip"
if($update -eq "True")
    {
    The rest of my code
    }

Upvotes: 0

Views: 910

Answers (1)

Shay Levy
Shay Levy

Reputation: 126702

Try to replace %20 with a space. %20 is used in web addresses.

Upvotes: 1

Related Questions