[英]How to process a string in NSIS?
I have a string from the parameters that has a installation path using this code: 我有一个使用此代码的具有安装路径的参数字符串:
${GetParameters} $R0
${if} $R0 != ""
StrCpy $R1 $R0 "" 3
StrCpy $INSTDIR $R1 -1
${endif}
the $INSTDIR contains a path like this: $ INSTDIR包含以下路径:
C:\Program Files (x86)\My Applicatoin
I want to get "My Application" out of it and save it in a variable. 我想从中获取“我的应用程序”并将其保存在变量中。 I know that I should check the characters backwards until i reach the backslash ( \\ ) but I do not know how to implement it in NSIS syntax.
我知道我应该向后检查字符,直到到达反斜杠(\\),但我不知道如何在NSIS语法中实现它。
How can I get "My Application" from the folder path using NSIS? 如何使用NSIS从文件夹路径获取“我的应用程序” ?
Most string operations can be coded with just StrCpy
, StrCmp
and StrLen
. 大多数字符串操作只能使用
StrCpy
, StrCmp
和StrLen
进行编码。
A basic version that only checks \\
and not /
already exists: 仅检查
\\
而不/
已经存在的基本版本:
!include FileFunc.nsh
StrCpy $0 "C:\Program Files (x86)\My Application"
${GetFileName} $0 $1
DetailPrint $1
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.