2

I am trying to convert a MSDOS script to use Powershell. However, I haven't been able to figure out how to see if a variable path exists.

"if exist %~dp0%MyNewPig%\PigBreeds\%Type%%Breed%%Markings%_%EarNotch%\nul goto skipthis"

Can you help?

The Underdog

1 Answer 1

3

It would look something like this:

$ScriptRoot = Split-Path $script:MyInvocation.MyCommand.Path

if (Test-Path "$ScriptRoot\$PigBreed\Breeds\$MyNewPig_$PitBreed_$EarNotch\nul") {
    #Do whatever SKIPTHIS does here
}
Sign up to request clarification or add additional context in comments.

1 Comment

That totally worked with SKIPTHIS being changed to Write-Host "This customer directory already exists!" break; THANK YOU BENH!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.