我正在为jar应用创建一个Inno Setup安装程序.我现在要做的是在继续安装之前检查java是否存在.所以我只需要确保用户能够运行:
java -jar my-app.jar
Run Code Online (Sandbox Code Playgroud)
我现在正在做的是:
[Code]
function InitializeSetup(): Boolean;
var
ErrorCode: Integer;
JavaInstalled : Boolean;
Result1 : Boolean;
begin
JavaInstalled := RegKeyExists(HKLM,'SOFTWARE\JavaSoft\Java Runtime Environment\1.6');
if JavaInstalled then
begin
Result := true;
end else
begin
Result1 := MsgBox('This tool requires Java Runtime Environment version 1.6 or newer to run. Please download and install the JRE and run this setup again. Do you want to download it now?',
mbConfirmation, MB_YESNO) = idYes;
if Result1 = false then
begin
Result:=false;
end else …Run Code Online (Sandbox Code Playgroud) 这应该很简单,我需要在安装程序启动时停止运行任何以前版本的程序.
大多数人建议exe在Inno Setup启动之前制作一个这样做并调用它.我创建了一个exe使用AutoIt来杀死我程序的所有进程.问题是我不知道在安装任何东西之前如何让Inno Setup调用它.
如何在安装文件之前调用可执行文件?
或者,如果我可以检测程序是否正在运行并告诉用户关闭它,那也可以.
Inno Setup具有命令行参数/LOG="filename".我可以在Inno Setup脚本中指定日志文件名,因此我可以在以后的错误报告中包含它吗?
在我安装过程中,我运行了一个bat文件.如果bat文件返回错误,我需要中止/终止设置.我想让它MsgBox告诉用户发生了什么,然后让中止看起来像用户按下取消按钮.
是否可以中止/终止设置?
代码示例将非常感激.
[Run]
Filename: {tmp}\test.bat; WorkingDir: {tmp}; Flags: waituntilterminated runhidden
Run Code Online (Sandbox Code Playgroud) 我osk.exe从应用程序启动Windows屏幕键盘()时发现了许多线程,但我遇到了一些问题.这似乎是因为我在64位操作系统上运行32位应用程序.我已经尝试过WooCaSh发布的代码:
WinForms屏幕上的键盘
但是这三种不同的路径都不适合我.对于sysnative路径,Process.Start失败并显示 "无法找到指定的路径".对于system32和osk.exe路径,我得到"无法启动屏幕键盘"错误对话框.
我发现了一个可能的解决方法在这里,这是一个小比我一直在寻找(由eryang后)更加复杂:http://social.msdn.microsoft.com/Forums/en-US/netfx64bit/thread/10ebc62f-e6d7 -4072-9fd1-ea3784a0966f /
我目前在不同的服务器上有批处理脚本,它们将csv文件传输到不同位置的FTP服务器.我的脚本看起来与此类似:
echo user ftp_user> ftpcmd.dat
echo password>> ftpcmd.dat
echo put c:\directory\%1-export-%date%.csv>> ftpcmd.dat
echo quit>> ftpcmd.dat
ftp -n -s:ftpcmd.dat ftp.MyFTPSite.com
del ftpcmd.dat
Run Code Online (Sandbox Code Playgroud)
如果我想要一个安全的传输,我的脚本将如何更新?
谢谢.
我想很好地捕获“找不到主机 *** 的主机密钥”时的错误,并向最终用户提供适当的消息。我试过这个:
import pysftp, paramiko
try:
with pysftp.Connection('1.2.3.4', username='root', password='') as sftp:
sftp.listdir()
except paramiko.ssh_exception.SSHException as e:
print('SSH error, you need to add the public key of your remote in your local known_hosts file first.', e)
Run Code Online (Sandbox Code Playgroud)
但不幸的是输出不是很好:
SSH error, you need to add the public key of your remote in your local known_hosts file first. No hostkey for host 1.2.3.4 found.
Exception ignored in: <function Connection.__del__ at 0x00000000036B6D38>
Traceback (most recent call last):
File "C:\Python37\lib\site-packages\pysftp\__init__.py", line 1013, …Run Code Online (Sandbox Code Playgroud) 我使用此代码来了解密钥是否存在:
if RegKeyExists(HKEY_LOCAL_MACHINE, 'Software\Autodesk') then
begin
MsgBox('Key exists!!', mbInformation, MB_OK);
end;
Run Code Online (Sandbox Code Playgroud)
对于这个例子,它有效,我有消息框,但有了它,它没有:
if RegKeyExists(HKEY_LOCAL_MACHINE, 'Software\Autodesk\Maya') then
begin
MsgBox('Key exists!!', mbInformation, MB_OK);
end;
Run Code Online (Sandbox Code Playgroud)
但是"Maya"键存在于我的电脑上.有谁能够帮我 ?
编辑:
实际上,似乎inno-setup不能访问正确的键...例如,使用此代码我列出了所有子键Maya,但是(!)结果是所有子键HKEY_LOCAL_MACHINE\SOFTWARE...
if RegGetSubkeyNames(HKEY_LOCAL_MACHINE, 'SOFTWARE', Names) then
begin
S := '';
for I := 0 to GetArrayLength(Names)-1 do
S := S + Names[I] + #13#10;
MsgBox('List of subkeys:'#13#10#13#10 + S, mbInformation, MB_OK);
end;
Run Code Online (Sandbox Code Playgroud)
为什么这个HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node关键?
我需要C#编程方面的帮助; 我是新手,我来自C背景.我有一个这样的控制台应用程序:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Add_Function
{
class Program
{
static void Main(string[] args)
{
int a;
int b;
int c;
Console.WriteLine("Enter value of 'a':");
a = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter value of 'b':");
b = Convert.ToInt32(Console.ReadLine());
//why can't I not use it this way?
c = Add(a, b);
Console.WriteLine("a + b = {0}", c);
}//END Main
public int Add(int x, int y)
{
int result = x + y;
return result;
}//END Add
}//END Program …Run Code Online (Sandbox Code Playgroud) 我在Ubuntu 12.04 LTS中设置了FTP服务器.
现在,当我尝试通过命令行从Windows 7连接到FTP服务器时ftp.exe,我成功连接但我无法获取目录列表.我收到错误
200 PORT command successful. Consider using PASV.
425 Failed to establish connection.
Run Code Online (Sandbox Code Playgroud) inno-setup ×5
windows ×3
c# ×2
ftp ×2
installer ×2
registry ×2
sftp ×2
32bit-64bit ×1
batch-file ×1
exception ×1
function ×1
java ×1
logging ×1
paramiko ×1
pascalscript ×1
pysftp ×1
python ×1
winforms ×1