jingjihui 发表于 2018-9-2 14:23:19

PowerShell中运行Bcdedit命令出错

  见下图,当我尝试在PowerShell执行bcdedit删除其中一个启动项时,出现错误;而在CMD中运行时则正常。

  执行的命令是:
  bcdedit /delete {f33a2785-b94a-11e3-a6eb-00e0661386c5} /cleanup
  出错的原因:
  (1)PowerShell中将{}中的内容当作计算式对待;
  (2)CMD中将{…}整体看作字符;
  事实上{f33a2785-b94a-11e3-a6eb-00e0661386c5}就是字符;
  由此衍生出:
  (1)PowerShell并不是CMD的替代版,也不是CMD高级版;
  (2)CMD多年来积累大量的命令和工具在某些情况些比powershell要有用和方便,Powershell是未来,已见端倪;CMD是一宝,仍要把握;
  (3)在Powershell中运行旧CMD命令,可参考http://www.pstips.net/using-windows-powershell-to-run-old-command-line-tools-and-their-weirdest-parameters.html这篇文章;

页: [1]
查看完整版本: PowerShell中运行Bcdedit命令出错