脚本中切换到脚本当前目录

cd /D "%~dp0"
$scriptpath = $MyInvocation.MyCommand.Path
$dir = Split-Path $scriptpath
cd $dir
cd "$(dirname "${BASH_SOURCE[0]}")"