【发布时间】:2017-04-21 22:26:34
【问题描述】:
我目前正在尝试提取驻留在项目子文件夹中的powershell 脚本。当我的batch 文件运行时,它会尝试在项目中定位文件路径,但这样做没有任何成功。
我首先尝试直接传递 Teamcity 中的子文件夹:
set file = "subFolder\myPowershell.ps1"
我第二次尝试打电话:
set file = %~dp0"subFolder\myPowershell.ps1"
然后我尝试了:
set file = %cd%"subFolder\myPowershell.ps1"
仍然没有成功。如何从batch 文件中获取Teamcity 项目文件夹中此powershell 脚本的路径?
【问题讨论】:
-
%~dp0"subFolder\myPowershell.ps1"在我看来,引号的位置不正确。你试过"%~dp0subFolder\myPowershell.ps1"吗? -
set "file=%~dp0subFolder\myPowershell.ps1"获取变量file的纯路径,不带引号... -
@Laf 是的,我尝试在引用中包含
%~dp0。
标签: batch-file teamcity