File 将shell应用程序输出重定向到带有HTA应用程序的文件

File 将shell应用程序输出重定向到带有HTA应用程序的文件,file,shell,redirect,hta,File,Shell,Redirect,Hta,有人能告诉我为什么重定向到文件在我的HTA程序中不起作用吗?它包含以下内容: Set objShell = CreateObject("Shell.Application") objShell.ShellExecute "md5sums.exe", "tarball.tar > .\md5sum.log", , , NORMAL_WINDOW 当我在没有重定向的情况下用上面两行运行HTA程序时,它工作得很好。但第二次添加“>。\md5sum.log”时,md5sums.exe抛出以下错误

有人能告诉我为什么重定向到文件在我的HTA程序中不起作用吗?它包含以下内容:

Set objShell = CreateObject("Shell.Application")
objShell.ShellExecute "md5sums.exe", "tarball.tar > .\md5sum.log", , , NORMAL_WINDOW
当我在没有重定向的情况下用上面两行运行HTA程序时,它工作得很好。但第二次添加“>。\md5sum.log”时,md5sums.exe抛出以下错误:

,这意味着它将忽略重定向符号并尝试获取不存在的md5sum.log文件的校验和

md5sums.exe只是一个外部校验和程序。当我从命令行运行以下命令时,它工作正常:

,将tarball.tar的校验和按预期传送到md5sum.log文件


我在互联网上到处搜索,没有找到解决办法。我非常感谢任何人能提供的任何帮助。

终于解决了!如果有人遇到这种情况:

shellCmd = "cmd /c md5sums.exe ""tarball.tar"" > ""md5sum.log"""
Set shell = CreateObject("WScript.Shell")
shell.Run shellCmd
 md5sums.exe tarball.tar > .\md5sum.log
shellCmd = "cmd /c md5sums.exe ""tarball.tar"" > ""md5sum.log"""
Set shell = CreateObject("WScript.Shell")
shell.Run shellCmd