Variables 将变量从powershell脚本传输到批处理

Variables 将变量从powershell脚本传输到批处理,variables,powershell,batch-file,Variables,Powershell,Batch File,我正在powershell脚本中运行.bat脚本,代码为: cmd.exe /c ($scriptsDir + "myBat.bat") 我在PS中定义了一些变量,例如 $batDir = "C:\Users\...\...\...\" 在.bat中我如何使用曾经定义的$batDir变量?只需将这一行放在bat文件开头的某个地方 set "$batDir=%~1" 把蝙蝠叫做 cmd.exe /c ($scriptsDir + "myBat.bat" + " " + $batDir) 那

我正在powershell脚本中运行.bat脚本,代码为:

cmd.exe /c ($scriptsDir + "myBat.bat")
我在PS中定义了一些变量,例如

$batDir = "C:\Users\...\...\...\"

在.bat中我如何使用曾经定义的$batDir变量?

只需将这一行放在bat文件开头的某个地方

set "$batDir=%~1"
把蝙蝠叫做

cmd.exe /c ($scriptsDir + "myBat.bat" + " " + $batDir)

那么mybat中使用的命令行参数呢?谢谢:就是这个!