|
Re: How to convert %~dp0 Hello Gil,
> For those who may be unfamiliar, if I run a dos batch script that's
> not in
> my current working directory, then I can include this in the script to
> refer
> to the directory that the script is actually in:
> %~dp0
> Is there a way to do this in PowerShell?
>
> Thanks,
> Gil
from a previous post, we know that you can do this:
$0 = $myInvocation.MyCommand.Definition
from there, we can get:
$dp0 = [System.IO.Path]::GetDirectoryName($0)
of course, you can name the var anything you want....
thanks,
mark |