简体   繁体   English

NSIS-编译前运行批处理文件

[英]NSIS - Running a batch file before compiling

I want to run a batch before i compile the NSIS script. 我想在编译NSIS脚本之前运行一个批处理。

I found execWait. 我找到了execWait。 This start the batch file while the installation of my application. 这将在安装我的应用程序时启动批处理文件。

I also tried !execute 'batch.bat' but then i get an error while compiling. 我也尝试了!execute'batch.bat',但是编译时出现错误。

This is the content of my batch file: 这是我的批处理文件的内容:

@echo off
@type file.txt > destination.txt
@echo. >> destination.txt
@svnversion.exe >> destination.txt

1. Update 1.更新

This is what i put in my nsi file but it doesn't work. 这是我放入我的nsi文件中的内容,但是它不起作用。

!tempfile BAT
!appendfile "${BAT}.cmd" "@echo off$\r$\n"
!appendfile "${BAT}.cmd" "@type file.txt > destination.txt$\r$\n"
!appendfile "${BAT}.cmd" "@echo. >> destination.txt$\r$\n"
!appendfile "${BAT}.cmd" "@svnversion.exe >> destination.txt$\r$\n"
!system '"${BAT}.cmd"'
!delfile "${BAT}.cmd"
!undef BAT

The Error is "Cant't open output file" "Error - aborting creation process" 错误是“无法打开输出文件”“错误-正在中止创建过程”

Do i something wrong in the sourcecode? 我的源代码有问题吗?

Try !system . 尝试!system

You can even create the batch file in the .nsi: 您甚至可以在.nsi中创建批处理文件:

!tempfile BAT
!appendfile "${BAT}.cmd" "@echo off$\r$\n"
!appendfile "${BAT}.cmd" "@echo Hello$\r$\n"
!system '"${BAT}.cmd"'
!delfile "${BAT}.cmd"
!undef BAT

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM