Skip to content

Commit 8c0b25f

Browse files
yjl9903targos
authored andcommitted
doc: add copy node executable guide on windows
PR-URL: #47781 Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Debadree Chatterjee <[email protected]>
1 parent d0283ed commit 8c0b25f

File tree

1 file changed

+40
-4
lines changed

1 file changed

+40
-4
lines changed

doc/api/single-executable-applications.md

+40-4
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,29 @@ tool, [postject][]:
4343
```
4444

4545
4. Create a copy of the `node` executable and name it according to your needs:
46+
47+
* On systems other than Windows:
48+
4649
```console
4750
$ cp $(command -v node) hello
4851
```
4952

53+
* On Windows:
54+
55+
Using PowerShell:
56+
57+
```console
58+
$ cp (Get-Command node).Source hello.exe
59+
```
60+
61+
Using Command Prompt:
62+
63+
```console
64+
$ for /F "tokens=*" %n IN ('where.exe node') DO @(copy "%n" hello.exe)
65+
```
66+
67+
The `.exe` extension is necessary.
68+
5069
5. Remove the signature of the binary (macOS and Windows only):
5170

5271
* On macOS:
@@ -61,13 +80,14 @@ tool, [postject][]:
6180
skipped, ignore any signature-related warning from postject.
6281

6382
```console
64-
$ signtool remove /s hello
83+
$ signtool remove /s hello.exe
6584
```
6685

6786
6. Inject the blob into the copied binary by running `postject` with
6887
the following options:
6988

70-
* `hello` - The name of the copy of the `node` executable created in step 2.
89+
* `hello` / `hello.exe` - The name of the copy of the `node` executable
90+
created in step 4.
7191
* `NODE_SEA_BLOB` - The name of the resource / note / section in the binary
7292
where the contents of the blob will be stored.
7393
* `sea-prep.blob` - The name of the blob created in step 1.
@@ -79,12 +99,18 @@ tool, [postject][]:
7999

80100
To summarize, here is the required command for each platform:
81101

82-
* On systems other than macOS:
102+
* On Linux:
83103
```console
84104
$ npx postject hello NODE_SEA_BLOB sea-prep.blob \
85105
--sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2
86106
```
87107

108+
* On Windows:
109+
```console
110+
$ npx postject hello.exe NODE_SEA_BLOB sea-prep.blob \
111+
--sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2
112+
```
113+
88114
* On macOS:
89115
```console
90116
$ npx postject hello NODE_SEA_BLOB sea-prep.blob \
@@ -106,15 +132,25 @@ tool, [postject][]:
106132
binary would still be runnable.
107133

108134
```console
109-
$ signtool sign /fd SHA256 hello
135+
$ signtool sign /fd SHA256 hello.exe
110136
```
111137

112138
8. Run the binary:
139+
140+
* On systems other than Windows
141+
113142
```console
114143
$ ./hello world
115144
Hello, world!
116145
```
117146

147+
* On Windows
148+
149+
```console
150+
$ .\hello.exe world
151+
Hello, world!
152+
```
153+
118154
## Generating single executable preparation blobs
119155

120156
Single executable preparation blobs that are injected into the application can

0 commit comments

Comments
 (0)