指挥工作,如果通过在命令提示符下,但不是在脚本中运行..? [英] Command works if run through the command prompt but not in a script..?

查看:161
本文介绍了指挥工作,如果通过在命令提示符下,但不是在脚本中运行..?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图脚本的一些使用批处理文件,因为PowerShell不正确地安装补丁补丁的安装。我跑的命令是这样的:

  DISM /在线/加包/PackagePath:\"C:\\<path>\\5cbb03ca-7a2a-4326-952f-80ad8052a886\\windows6.1-kb2836942-x64-ex$p$pss.cab\"

这时候在命令行直接运行完美。但如果我把它放在一个名为 example.bat 文件时,它失败,出现以下消息:

 THD不被识别为一个内部或外部命令


解决方案

我觉得你的批处理文件保存为统一code。

重新打开在记事本中,并重新保存它,确保编码字段设置为ANSI。

I'm trying to script the installation of a number of patches using a batch file since powershell doesn't properly install the patches. The command I'm running is this:

dism /online /add-package /PackagePath:"C:\<path>\5cbb03ca-7a2a-4326-952f-80ad8052a886\windows6.1-kb2836942-x64-express.cab"

That works perfectly when run directly from the command line. But if I put it in a file called example.bat it fails with the following message:

'þd' is not recognized as an internal or external command

解决方案

I think your batch file is saved as Unicode.

Re-open it in Notepad and re-save it, making sure the Encoding field is set to ANSI.

这篇关于指挥工作,如果通过在命令提示符下,但不是在脚本中运行..?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆