enter image description here例如。
$ap = Get-location "cd c:\osit\bin\acf"
$ap ./acf -t
但是它不起作用。错误,它不是命令行开关。
因为acf -t
仅适用于该目录,所以我需要创建脚本的原因将自动调用该目录并运行该acf -t
请帮助。谢谢。
答案 0 :(得分:0)
删除Get-Location
部分,cd
就可以正常工作:
cd c:\osit\bin\acf
.\acf.cmd -t
答案 1 :(得分:0)
尝试一下(注释以#
开头;没有“代码”)
# save the current path to variable $path
$path = Get-Location
# change path to executable
Set-Location -Path 'c:\osit\bin\acf'
# execute programme
.\act.cmd -t
# change back to the path we came from
Set-Location -Path $path