批处理文件命令不起作用(Batch file command not working)

编程入门 行业动态 更新时间:2024-10-15 08:24:44
批处理文件命令不起作用(Batch file command not working)

我试图远程运行这个批处理文件它将杀死IE进程,但当我尝试打开.lnk文件时,它不会这样做。 当我进入该计算机时,打开命令提示符并输入命令以运行它运行的.lnk文件,没有问题..请帮忙!

远程执行批处理文件的代码:

psexec -u Administrator -p password -i -d \\hostname "c:\Emergency_POD\test.bat"

要运行的机器上的代码:(只有taskill命令工作..而不是for命令)cd /

taskkill /im iexplore.exe /f for %a in ("C:\Emergency_POD\*.lnk") do @start "" "%a"

在cmd上运行的命令(此命令无问题:

for %a in ("C:\Emergency_POD\*.lnk") do @start "" "%a"

I am trying to run this batch file remotely It will kill the IE process's but when I try to open a .lnk file it won't do it. When I go onto that machine, open up the command prompt and type in the command to run the .lnk file it works with no issues.. please help!

Code to remotely execute batch file:

psexec -u Administrator -p password -i -d \\hostname "c:\Emergency_POD\test.bat"

Code on machine to run: (Only the taskill command works.. not the for command) cd/

taskkill /im iexplore.exe /f for %a in ("C:\Emergency_POD\*.lnk") do @start "" "%a"

Command to run on cmd (This command works with no issues:

for %a in ("C:\Emergency_POD\*.lnk") do @start "" "%a"

最满意答案

在批处理文件中使用%%a替代%a可能会更好。

You'd probably be better off with %%a in place of %a in the batch file.

更多推荐

本文发布于:2023-08-06 06:58:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1446612.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不起作用   批处理文件   命令   Batch   command

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!