Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在批处理文件中使用命令而不使用所需的xml_Xml_Batch File_Cmd_Outlook - Fatal编程技术网

在批处理文件中使用命令而不使用所需的xml

在批处理文件中使用命令而不使用所需的xml,xml,batch-file,cmd,outlook,Xml,Batch File,Cmd,Outlook,我必须在我们公司的一些客户机上卸载Office 2013,并且需要一个简短的脚本来完成,这样它才能运行autonom @echo off echo Start Uninstall Programm echo Removing Office 2013... "C:\Program Files (x86)\Common Files\microsoft shared\OFFICE15\Office Setup Controller\setup.exe" /uninstall Proplus /con

我必须在我们公司的一些客户机上卸载Office 2013,并且需要一个简短的脚本来完成,这样它才能运行autonom

@echo off
echo Start Uninstall Programm
echo Removing Office 2013...

"C:\Program Files (x86)\Common Files\microsoft shared\OFFICE15\Office Setup Controller\setup.exe" /uninstall Proplus /config "C:\Program Files (x86)\Common Files\microsoft shared\OFFICE15\Office Setup Controller\PROPLUS\uninstallOffice.xml"

echo Uninstall complete, pls reboot now.
该程序运行良好,但对于Office卸载,它需要一个包含一些信息的.xml文件:

<Configuration Product="ProPlus">

<Display Level="none" CompletionNotice="no" SuppressModal="yes" AcceptEula="yes" />

</Configuration>
但是现在我必须让Prorgramm在没有.xml文件的客户机上运行,而且我无法将它复制到那里。 有没有一种方法可以让批处理文件知道它必须从.xml文件中知道什么,而不需要实际的.xml文件?
或者有没有一种方法可以让批处理文件写入.xml文件,保存并在以后使用?

您可以尝试将xml嵌入批处理:

<!-- : batch
@echo off
echo Start Uninstall Programm
echo Removing Office 2013...

"C:\Program Files (x86)\Common Files\microsoft shared\OFFICE15\Office Setup Controller\setup.exe" /uninstall Proplus /config "%~f0"

echo Uninstall complete, pls reboot now.
exit /b %errorlevel%

 --->


<Configuration Product="ProPlus">

<Display Level="none" CompletionNotice="no" SuppressModal="yes" AcceptEula="yes" />

</Configuration>

将其另存为.bat并重试。如果setup.exe对文件扩展名不敏感,则它可以工作

您可以尝试将xml嵌入批处理:

<!-- : batch
@echo off
echo Start Uninstall Programm
echo Removing Office 2013...

"C:\Program Files (x86)\Common Files\microsoft shared\OFFICE15\Office Setup Controller\setup.exe" /uninstall Proplus /config "%~f0"

echo Uninstall complete, pls reboot now.
exit /b %errorlevel%

 --->


<Configuration Product="ProPlus">

<Display Level="none" CompletionNotice="no" SuppressModal="yes" AcceptEula="yes" />

</Configuration>

将其另存为.bat并重试。如果setup.exe对文件扩展名不敏感,则它可以工作

我很确定setup.exe需要文件扩展名。稍后将对其进行测试以确保。我也不完全理解setup.exe是如何知道它应该使用嵌入的xml的,如果你能解释一下,那就好了it@Paxz-和->之间的部分将是xml的注释。对于cmd exe,该行将被解析为:批处理文件具有解析和执行阶段,在执行期间,这些阶段将被视为标签,即忽略。因此,这允许您在xml注释块中执行批处理代码。并且,退出行之后的所有内容都将被cmd.exe忽略。我刚才似乎没有将其标记为正确,我想迟做总比不做好:我很确定setup.exe需要文件扩展名。稍后将对其进行测试以确保。我也不完全理解setup.exe是如何知道它应该使用嵌入的xml的,如果你能解释一下,那就好了it@Paxz-和->之间的部分将是xml的注释。对于cmd exe,该行将被解析为:批处理文件具有解析和执行阶段,在执行期间,这些阶段将被视为标签,即忽略。因此,这允许您在xml注释块中执行批处理代码。并且,退出行之后的所有内容都将被cmd.exe忽略。我刚才似乎没有将其标记为正确,我想迟做总比不做强