Windows 10 为什么我的nsis脚本无法在Windows 10上使用execWait运行命令?
我想让我的nsis脚本运行命令行,该命令行是由我在脚本中的先前语句成功安装的。但它总是无法显示Windows 10 为什么我的nsis脚本无法在Windows 10上使用execWait运行命令?,windows-10,nsis,Windows 10,Nsis,我想让我的nsis脚本运行命令行,该命令行是由我在脚本中的先前语句成功安装的。但它总是无法显示 C:\mypath\SystemMaitainer.exe' is not recognized as an internal or external command, operable program or batch file. 我将相关代码放在安装部分之后,如下所示: Section "install" // Files copy statements SectionEnd Section
C:\mypath\SystemMaitainer.exe' is not recognized as an internal or external command, operable program or batch file.
我将相关代码放在安装部分之后,如下所示:
Section "install"
// Files copy statements
SectionEnd
Section "command"
nsExec::ExecToLog 'cmd.exe /c "$INSTDIR\SystemMaitainer.exe" -install'
Pop $0
DetailPrint ""
DetailPrint " Return value: $0"
DetailPrint ""
SectionEnd
Section "serverice"
ClearErrors
SetOutPath "$SYSDIR"
file "mycmd.exe"
ExecWait '"$SYSDIR\mycmd.exe" -option'
SectionEnd
如何解决我的问题?谢谢为什么有关nsEXec的语句总是失败,但命令可以在cmd中成功运行
经过调查,我的脚本可以工作了,我应该把execwait命令和copy语句放在一起,如下所示:
Section "install"
// Files copy statements
SectionEnd
Section "command"
nsExec::ExecToLog 'cmd.exe /c "$INSTDIR\SystemMaitainer.exe" -install'
Pop $0
DetailPrint ""
DetailPrint " Return value: $0"
DetailPrint ""
SectionEnd
Section "serverice"
ClearErrors
SetOutPath "$SYSDIR"
file "mycmd.exe"
ExecWait '"$SYSDIR\mycmd.exe" -option'
SectionEnd
但它在Windows 7上运行得非常好,但在Windows 10上失败,ExecWait无法成功运行,如果没有ret错误消息,请再次帮助我!我非常感谢帮助我的人 该错误消息来自cmd.exe。SystemMaitaner拼写错误,这可能就是问题所在?或者您禁用了copy命令周围的WOW64重定向,但没有禁用exec命令 如果不执行stdout重定向,则不必在命令前面加cmd/c $SysDir是特殊的,因为64位系统上有两个system32目录 您可以使用$WinDir\SysNative\或x64.nsh中的宏在32位进程中访问64位system32目录:
!include x64.nsh
${DisableX64FSRedirection}
ExecWait '"$SysDir\app.exe"'
${EnableX64FSRedirection}
显示File命令会有所帮助。另外,$InstDir是否在Windows目录中?程序文件?Windows目录,谢谢!您尚未将File命令添加到示例中。我还想知道$InstDir的值是多少。它是$SYSDIR,C:\Windows\System32\,在Windows 10上有任何特殊的保护策略吗?$SYSDIR有点特殊,但我不能肯定,因为您拒绝显示File命令及其周围的内容!谢谢你的帖子。我更新了问题,我在Win10上有问题,有什么建议要解决吗?是的!这是关键!我自己也找到了!我必须把exec语句放在这两个X86宏之间,谢谢!