Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
steve02081504 committed Dec 13, 2023
1 parent c8b6f8b commit ab17402
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 5 deletions.
27 changes: 23 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,20 @@ ps2exe .\source.ps1 .\target.exe

compiles `source.ps1` into the executable target.exe (if `.\target.exe` is omitted, output is written to `.\source.exe`).

## Comparison

Compared to [`MScholtes/PS2EXE@678a892`](https://github.com/MScholtes/PS2EXE/tree/678a89270f4ef4b636b69db46b31e1b4e0a9e1c5), this project:

- Adds [powerful preprocessing features](#prepossessing) that allow you to preprocess the script before compiling (instead of copy-pasting everything and embedding it into the script)
- Special parameters are no longer enabled by default in the generated files, but can be enabled with the new `-SepcArgsHandling` parameter if needed.
- The `-CompilerOptions` parameter has been added to allow you to further customise the generated executable.
- Added [`-Minifyer` parameter](#minifyer) to allow you to pre-process scripts before compilation to get smaller generated executables
- Optimised option handling and window title display under the `-noConsole` parameter, you can now customise the title of popup windows by setting `$Host.UI.RawUI.WindowTitle`.
- Removed exe files from code repository
- Removed the code for PS2EXE-GUI, considering it's cumbersome to use and requires extra effort to maintain
- Separated the cs file from the ps1 file, easier to read and maintain.
- and more...

## Parameter

```powershell
Expand Down Expand Up @@ -88,10 +102,10 @@ PS2EXE preprocesses the script before compiling.
#### `#_if <condition>`/`#_else`/`#_endif`

```powershell
#_if <condition>
<code>
#_if PSEXE
#_include ../src/opt/opt_init.ps1
#_else
<code>
. $PSScriptRoot/../src/opt/opt_init.ps1
#_endif
```

Expand All @@ -109,7 +123,12 @@ Includes the content of the file `<filename>` or `<file>` into the script. The c

Unlike the `#_if` statement, if you don't enclose the filename in quotes, the `#_include` family treats the trailing space & `#` as part of the filename as well.

The content of the file is preprocessed when `#_include` is used.
```powershell
#_include $PSScriptRoot/super #weird filename.ps1
#_include "$PSScriptRoot/filename.ps1" #safe comment!
```

The content of the file is preprocessed when `#_include` is used, which allows you to include files at multiple levels.

`#_include_as_value` inserts the content of the file as a string value into the script. The content of the file is not preprocessed.

Expand Down
21 changes: 20 additions & 1 deletion README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@ ps2exe .\source.ps1 .\target.exe

`source.ps1`编译为`target.exe`(如果省略`.\target.exe`,输出将写入`.\source.exe`)。

## 比较

[`MScholtes/PS2EXE@678a892`](https://github.com/MScholtes/PS2EXE/tree/678a89270f4ef4b636b69db46b31e1b4e0a9e1c5)相比,该项目:

- 追加了[强大的预处理功能](#预处理),允许你在编译前对脚本进行预处理(而不是将所有内容复制粘贴嵌入到脚本中)
- 生成的文件中特殊参数不再默认启用,如有需要可使用`-SepcArgsHandling`参数启用
- 追加了`-CompilerOptions`参数,允许你进一步定制生成的可执行文件
- 追加了[`-Minifyer`参数](#minifyer),允许你在编译前对脚本进行预处理,以获得更小的生成可执行文件
- 优化了`-noConsole`参数下的选项处理和窗口标题显示,你现在可以通过设置`$Host.UI.RawUI.WindowTitle`来自定义弹窗的标题
- 移除了代码仓库中的exe文件
- 删除了PS2EXE-GUI的代码,考虑到其使用麻烦并需要额外的精力维护
- 将cs文件从ps1文件中分离出来,阅读和维护更方便
- 以及更多...

## 参数

```powershell
Expand Down Expand Up @@ -106,7 +120,12 @@ PS2EXE 会在编译前对脚本进行预处理。

`#_if`语句不同 如果你不使用引号将文件名括起来,`#_include`系列预处理命令会将末尾的空格、`#`也视为文件名的一部分

使用 `#_include` 时,文件内容会经过预处理。
```powershell
#_include $PSScriptRoot/super #weird filename.ps1
#_include "$PSScriptRoot/filename.ps1" #safe comment!
```

使用 `#_include` 时,文件内容会经过预处理,这允许你多级包含文件。

`#_include_as_value` 会将文件内容作为字符串值插入脚本。文件内容不会被预处理。

Expand Down

0 comments on commit ab17402

Please sign in to comment.