从包含空格的路径在CMD.EXE中执行Powershell脚本

时间:2015-07-08 14:24:07

标签: windows powershell cmd

我有一个ps文件,我想从带有空格的路径从Windows Server 2008中的cmd.exe执行。

我在带有空格的路径中有ps文件,假设:" C:\ My powershell Files"

所以从这条路径开始我需要cmd命令才能执行:

c:\My powershell Files\powershell.exe %CD%\AddValuesRegistry.ps1"

我有PowerShell v2.0,所以我希望它可以使用这个版本。

我检查过以下命令但没有成功:

c:\My powershell Files\powershell.exe -file '%CD%\AddValuesRegistry.ps1'
c:\My powershell Files\powershell.exe -Command "& {& '%CD%\AddValuesRegistry.ps1'}"

有什么想法吗?

0 个答案:

没有答案
相关问题