Running Scripts

write a script

allow scripts to run

View Code
1 powershell.exe -command Set-ExecutionPolicy "Bypass"

run scripts

View Code
1 powershell.exe -command "&{%~dp0install.ps1}"

http://technet.microsoft.com/en-us/library/bb613481%28v=vs.85%29.aspx

http://blog.csdn.net/subkiller/article/details/7817885

%cd%代表的是执行文件的当前目录,强调bat是在哪里启动的;->盘符展开后是可改变的

%~dp0代表的是bat文件所在的文件目录,强调bat的文件位置     ->盘符展开后是不可改变的

原文地址:https://www.cnblogs.com/daishuguang/p/3064533.html