bash / powershell切换到脚本所在目录

切换工作目录到脚本所在目录

bash:

#!/usr/bin/env sh
cd $(dirname $0)
#cd $(dirname $(readlink $0)) #soft  link

powershell:

$dir = Split-Path -Parent $MyInvocation.MyCommand.Definition
cd $dir

https://www.cnblogs.com/FlyFive/p/3640267.html

原文地址:https://www.cnblogs.com/wswind/p/11797355.html