码迷,mamicode.com
首页 > 其他好文 > 详细

取出当前脚本所在位置、文件名

时间:2014-12-04 11:37:16      阅读:96      评论:0      收藏:0      [点我收藏+]

标签:style   blog   io   ar   color   os   sp   on   文件   

 

 1 #分别取出当前脚本的父目录、文件名
 2 $Currentpath1    = Split-Path -parent $MyInvocation.MyCommand.Definition 
 3 $Currentpath2    = Split-Path -leaf $MyInvocation.MyCommand.Definition 
 4 write-host $Currentpath1 
 5 write-host $Currentpath2
 6 #取当前脚本全路径
 7 #write-host $MyInvocation.MyCommand.Definition 
 8 
 9 #功能同上
10 $Currentpath3    = Split-Path -parent $MyInvocation.MyCommand.Path
11 $Currentpath4   = Split-Path -leaf $MyInvocation.MyCommand.Path

 

取出当前脚本所在位置、文件名

标签:style   blog   io   ar   color   os   sp   on   文件   

原文地址:http://www.cnblogs.com/dreamer-fish/p/4142316.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!