从调试Inno Setup的安装程序执行的非工作批处理文件 [英] Debugging non-working batch file executed from Inno Setup installer

查看:1374
本文介绍了从调试Inno Setup的安装程序执行的非工作批处理文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图安装Tomcat作为使用Inno Setup的通过命令行的Windows 10服务,但我遇到了问题,目前这是我的语法。

  [运行]
文件名:NET.EXE;标志:runascurrentuser;参数:用户elt_user TrackFox38#/加;将安装tomcat的使得它作为服务运行注意在INNO这是一个单线路
文件名:{}的src \\ .. \\ Apache的Tomcat的7.0.69 \\ BIN \\ service.bat;标志:runascurrentuser;参数:tomcat7 // // IS Tomcat7 --DisplayName ='Apache_Tomcat_7'^ --install =C:\\ Program Files文件\\ Tomcat的\\ BIN \\ tomcat7.exe'--Jvm =自动^ --StartMode = JVM - 的StopMode = JVM ^ --StartClass = org.apache.catalina.startup.Bootstrap --StartParams = ^开头--StopClass = org.apache.catalina.startup.Bootstrap --StopParams =停

奇怪的是,它的作品时,我手动将其粘贴到命令行。起初我以为这是一个权限问题,但该 NET.EXE 命令的工作和Tomcat并不调用质疑的事实。我也有需要设置为管理员权限和程序需要管理员权限才能启动安装程序,所以我不认为它是一个用户的问题。我是新来的创新安装,有点困在这里。

调试输出:

  [09:18:54.770]文件名:C:\\程序\\输出\\ .. \\ Apache的tomcat- 7.0.69 \\ BIN \\ service.bat
[09:18:54.771]参数:// tomcat7 IS // Tomcat7 --DisplayName ='Apache_Tomcat_7'^ --install =C:\\ Program Files文件\\ Tomcat的\\ BIN \\ tomcat7.exe'--Jvm =自动^ - -startmode = JVM --StopMode = JVM ^ --StartClass = org.apache.catalina.startup.Bootstrap --StartParams = ^开头--StopClass = org.apache.catalina.startup.Bootstrap --StopParams =停止
[09:18:54.867]进程退出code:0


解决方案

当你执行一个批处理文件(或任何命令),它的结果(或错误),要么完全不可见的(特别是当使用runhidden 标记)或消失迅速,你不能阅读。

在这种情况下,通过的cmd.exe 明确运行命令(Inno Setup的做它含蓄地对自己),但这次 /氏/ code>交换机而不是更常见的 / C 开关。在 / K 开关确保控制台窗口不会关闭它自己。

所以

而不是:

  [运行]
文件名:{应用} \\ SETUP.BAT;参数:论据

或等效的:

  [运行]
文件名:{cmd},在;参数:/ C {应用} \\ SETUP.BAT参数

使用:

  [运行]
文件名:{cmd},在;参数:/ K {应用} \\ SETUP.BAT参数

然后控制台窗口中的的setup.bat 结束后停留,你可以看到最终的错误。

如果该批处理文件隐藏正在执行的命令共同关闭@echo 命令启动,暂时注释掉与 REM 将帮助调试了。

在这里输入的形象描述

I am trying to install Tomcat as a service on Windows 10 via command line using Inno Setup but I am running into problems currently this is my syntax.

[Run] 
Filename: net.exe; Flags: runascurrentuser; parameters: "user elt_user TrackFox38# /add"

; installs tomcat makes it run as a service NOTE THAT IN INNO THIS IS A SINGLE LINE
Filename: {src}\..\apache-tomcat-7.0.69\bin\service.bat; Flags: runascurrentuser; parameters: "tomcat7 //IS//Tomcat7 --DisplayName='Apache_Tomcat_7' ^ --Install='C:\Program Files\Tomcat\bin\tomcat7.exe' --Jvm=auto ^ --StartMode=jvm --StopMode=jvm ^ --StartClass=org.apache.catalina.startup.Bootstrap --StartParams=start ^ --StopClass=org.apache.catalina.startup.Bootstrap --StopParams=stop"

The weird thing is that it works when I manually paste it into command line. At first I thought it was a permissions issue but the fact that the net.exe command works and Tomcat doesn't calls that into question. Also I have privileges required set to admin and the app needs admin privileges to start the installer so I don't think its a user issue. I'm new to Inno Setup and a bit stuck here.

Debug output:

[09:18:54.770] Filename: C:\program\Output\..\apache-tomcat-   7.0.69\bin\service.bat 
[09:18:54.771] Parameters: tomcat7 //IS//Tomcat7 --DisplayName='Apache_Tomcat_7' ^ --Install='C:\Program Files\Tomcat\bin\tomcat7.exe' --Jvm=auto ^ --StartMode=jvm --StopMode=jvm ^ --StartClass=org.apache.catalina.startup.Bootstrap --StartParams=start ^ --StopClass=org.apache.catalina.startup.Bootstrap --StopParams=stop 
[09:18:54.867] Process exit code: 0

解决方案

When you execute a batch file (or any command), its results (or errors) are either not visible at all (particularly when runhidden flag is used) or disappear that quickly that you cannot read them.

In that case, run the command explicitly via cmd.exe (Inno Setup does it implicitly on its own), but this time with /K switch instead of a more common /C switch. The /K switch ensures that the console windows does not close on its own.

So instead of:

[Run] 
Filename: {app}\setup.bat; Parameters: "arguments"

or an equivalent:

[Run] 
Filename: {cmd}; Parameters: "/C {app}\setup.bat arguments"

Use:

[Run] 
Filename: {cmd}; Parameters: "/K {app}\setup.bat arguments"

Then the console window stays after the setup.bat finishes and you can see eventual errors.

If the batch file starts with common @echo off command that hides the commands being executed, temporarily commenting out this line with rem will help debugging too.

这篇关于从调试Inno Setup的安装程序执行的非工作批处理文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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