Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:bug: Register Microsoft Store CLI execution alias https://github.com/siyuan-note/siyuan/issues/20158

Daniel138cd71cada8
diff --git a/README.md b/README.md
index adbf5973b1..755d207f0d 100644
--- a/README.md
+++ b/README.md
@@ -433,24 +433,17 @@ Run `siyuan --help` for the full command tree. Use `-f json` (default is `-f tab
The CLI binary is `<install-dir>/resources/kernel/SiYuan-Kernel`, invoked via the `siyuan` command.
-- **Windows**: the installer automatically adds the kernel directory to `PATH`, so `siyuan` works out of the box. The Microsoft Store edition runs in an MSIX sandbox and cannot modify `PATH`; deploy a `siyuan.cmd` shim once (survives Store updates):
+- **Windows**: the installer automatically adds the kernel directory to `PATH`, so `siyuan` works out of the box. The Microsoft Store edition (3.8.7+) registers the `siyuan.exe` app execution alias on Windows 10 1607 (build 14393) or later. After installing or updating, open a new terminal and run `siyuan --help`
```powershell
- # Microsoft Store edition only — run once in PowerShell
- $shimDir = "$env:LOCALAPPDATA\Microsoft\WindowsApps" # already in PATH by default
- @(
- '@echo off'
- 'setlocal'
- 'set "ROOT="'
- 'for /f "delims=" %%i in (''powershell -NoProfile -Command "(Get-AppxPackage *SiYuan*).InstallLocation"'') do set "ROOT=%%i"'
- 'if not defined ROOT goto :noshim'
- '"%ROOT%\app\resources\kernel\SiYuan-Kernel.exe" %*'
- 'exit /b %ERRORLEVEL%'
- ':noshim'
- '1>&2 echo siyuan: Microsoft Store edition not found'
- 'exit /b 1'
- ) | Set-Content "$shimDir\siyuan.cmd"
+ siyuan --help
+
+ # Check which command is being used
+ Get-Command siyuan -All
+ where.exe siyuan
```
- To remove on uninstall: `Remove-Item "$env:LOCALAPPDATA\Microsoft\WindowsApps\siyuan.cmd"`.
+ If the command is unavailable, check that the SiYuan app execution alias is enabled in Windows and `%LOCALAPPDATA%\Microsoft\WindowsApps` is in `PATH`. The commands above show command resolution; multiple SiYuan editions or `PATH` order may select another executable
+
+ If you created the old `siyuan.cmd` shim, first verify the Store alias directly with `& "$env:LOCALAPPDATA\Microsoft\WindowsApps\siyuan.exe" --help`, then optionally remove the shim: `Remove-Item "$env:LOCALAPPDATA\Microsoft\WindowsApps\siyuan.cmd"`
- **macOS**: create a symlink after installing:
```bash
ln -s /Applications/SiYuan.app/Contents/Resources/kernel/SiYuan-Kernel /usr/local/bin/siyuan
diff --git a/README.zh-CN.md b/README.zh-CN.md
index 358cfd961d..ab63b87e3f 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -524,24 +524,17 @@ siyuan export md --id <block-id> -w ~/SiYuan
CLI 可执行文件为 `<安装目录>/resources/kernel/SiYuan-Kernel`,可通过 `siyuan` 命令调用。
-- **Windows**:安装程序自动将内核目录加入 `PATH`,可直接使用 `siyuan`。微软商店版运行在 MSIX 沙箱中,无法自动修改 `PATH`;可部署一个 `siyuan.cmd` 转发器(一次性,商店版更新后依然有效):
+- **Windows**:安装程序自动将内核目录加入 `PATH`,可直接使用 `siyuan`。微软商店版(3.8.7 及以上)在 Windows 10 1607(内部版本 14393)及以上系统中注册 `siyuan.exe` 应用执行别名。安装或更新后,打开新的终端并运行 `siyuan --help`
```powershell
- # 仅适用于微软商店版 —— 在 PowerShell 中运行一次
- $shimDir = "$env:LOCALAPPDATA\Microsoft\WindowsApps" # 该目录默认已在 PATH 中
- @(
- '@echo off'
- 'setlocal'
- 'set "ROOT="'
- 'for /f "delims=" %%i in (''powershell -NoProfile -Command "(Get-AppxPackage *SiYuan*).InstallLocation"'') do set "ROOT=%%i"'
- 'if not defined ROOT goto :noshim'
- '"%ROOT%\app\resources\kernel\SiYuan-Kernel.exe" %*'
- 'exit /b %ERRORLEVEL%'
- ':noshim'
- '1>&2 echo siyuan: 未找到微软商店版'
- 'exit /b 1'
- ) | Set-Content "$shimDir\siyuan.cmd"
+ siyuan --help
+
+ # 检查实际使用的命令
+ Get-Command siyuan -All
+ where.exe siyuan
```
- 卸载商店版时如需清理:`Remove-Item "$env:LOCALAPPDATA\Microsoft\WindowsApps\siyuan.cmd"`。
+ 如果找不到命令,请检查 Windows 中思源的应用执行别名是否已启用,以及 `%LOCALAPPDATA%\Microsoft\WindowsApps` 是否在 `PATH` 中。上述命令可检查命令解析结果;同时安装多个思源版本或 `PATH` 顺序可能导致调用其他可执行文件
+
+ 如果曾创建旧的 `siyuan.cmd` 转发器,请先运行 `& "$env:LOCALAPPDATA\Microsoft\WindowsApps\siyuan.exe" --help` 确认商店版别名可用,再按需删除转发器:`Remove-Item "$env:LOCALAPPDATA\Microsoft\WindowsApps\siyuan.cmd"`
- **macOS**:安装后创建软链接:
```bash
ln -s /Applications/SiYuan.app/Contents/Resources/kernel/SiYuan-Kernel /usr/local/bin/siyuan
diff --git a/app/appx/AppxManifest-arm64.xml b/app/appx/AppxManifest-arm64.xml
index 6032638fa1..64c8cfcc4e 100644
--- a/app/appx/AppxManifest-arm64.xml
+++ b/app/appx/AppxManifest-arm64.xml
@@ -3,8 +3,10 @@
<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
+ xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3"
xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10"
- xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities">
+ xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
+ IgnorableNamespaces="uap3 desktop">
<!-- use single quotes to avoid double quotes escaping in the publisher value -->
<Identity Name="89C2A984.SiYuan"
ProcessorArchitecture="arm64"
@@ -49,6 +51,13 @@
</uap:VisualElements>
<Extensions>
+ <uap3:Extension Category="windows.appExecutionAlias"
+ Executable="app\resources\kernel\SiYuan-Kernel.exe"
+ EntryPoint="Windows.FullTrustApplication">
+ <uap3:AppExecutionAlias>
+ <desktop:ExecutionAlias Alias="siyuan.exe"/>
+ </uap3:AppExecutionAlias>
+ </uap3:Extension>
<uap:Extension Category="windows.protocol">
<uap:Protocol Name="siyuan"/>
</uap:Extension>
diff --git a/app/appx/AppxManifest.xml b/app/appx/AppxManifest.xml
index 7d7f78b776..a21cf9e03a 100644
--- a/app/appx/AppxManifest.xml
+++ b/app/appx/AppxManifest.xml
@@ -3,8 +3,10 @@
<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
+ xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3"
xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10"
- xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities">
+ xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
+ IgnorableNamespaces="uap3 desktop">
<!-- use single quotes to avoid double quotes escaping in the publisher value -->
<Identity Name="89C2A984.SiYuan"
ProcessorArchitecture="x64"
@@ -49,6 +51,13 @@
</uap:VisualElements>
<Extensions>
+ <uap3:Extension Category="windows.appExecutionAlias"
+ Executable="app\resources\kernel\SiYuan-Kernel.exe"
+ EntryPoint="Windows.FullTrustApplication">
+ <uap3:AppExecutionAlias>
+ <desktop:ExecutionAlias Alias="siyuan.exe"/>
+ </uap3:AppExecutionAlias>
+ </uap3:Extension>
<uap:Extension Category="windows.protocol">
<uap:Protocol Name="siyuan"/>
</uap:Extension>
diff --git a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20260612192252-sgw2paw.sy b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20260612192252-sgw2paw.sy
index 17a4319e9b..f3e84e11a2 100644
--- a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20260612192252-sgw2paw.sy
+++ b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20260612192252-sgw2paw.sy
@@ -6,7 +6,7 @@
"id": "20260612192252-sgw2paw",
"title": "Command Line Interface",
"type": "doc",
- "updated": "20260914195107"
+ "updated": "20261006133358"
},
"Children": [
{
@@ -67,7 +67,7 @@
"HeadingLevel": 2,
"Properties": {
"id": "20260618124055-rle3i8e",
- "updated": "20260618124055"
+ "updated": "20261006133358"
},
"Children": [
{
@@ -114,7 +114,7 @@
"ListData": {},
"Properties": {
"id": "20260618124055-ksybbk0",
- "updated": "20260618124055"
+ "updated": "20261006133358"
},
"Children": [
{
@@ -126,7 +126,7 @@
},
"Properties": {
"id": "20260618124055-fh52ukj",
- "updated": "20260618124055"
+ "updated": "20261006133358"
},
"Children": [
{
@@ -134,7 +134,7 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20260618124055-mo52pph",
- "updated": "20260618124055"
+ "updated": "20261006133358"
},
"Children": [
{
@@ -166,25 +166,25 @@
},
{
"Type": "NodeText",
- "Data": ". The Microsoft Store edition runs in an MSIX sandbox and cannot modify "
+ "Data": ". The Microsoft Store edition (3.8.7+) registers the "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
- "TextMarkTextContent": "PATH"
+ "TextMarkTextContent": "siyuan.exe"
},
{
"Type": "NodeText",
- "Data": "​; deploy a "
+ "Data": "​ app execution alias on Windows 10 1607 (build 14393) or later. After installing or updating, open a new terminal and run "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
- "TextMarkTextContent": "siyuan.cmd"
+ "TextMarkTextContent": "siyuan --help"
},
{
"Type": "NodeText",
- "Data": "​ shim once (survives Store updates)"
+ "Data": "​"
}
]
},
@@ -194,7 +194,7 @@
"IsFencedCodeBlock": true,
"Properties": {
"id": "20260708120000-enstore1",
- "updated": "20260708120000"
+ "updated": "20261006133358"
},
"Children": [
{
@@ -207,7 +207,7 @@
},
{
"Type": "NodeCodeBlockCode",
- "Data": "# Microsoft Store edition only — run once in PowerShell\n$shimDir = \"$env:LOCALAPPDATA\\Microsoft\\WindowsApps\" # already in PATH by default\n@(\n '@echo off'\n 'setlocal'\n 'set \"ROOT=\"'\n 'for /f \"delims=\" %%i in (''powershell -NoProfile -Command \"(Get-AppxPackage *SiYuan*).InstallLocation\"'') do set \"ROOT=%%i\"'\n 'if not defined ROOT goto :noshim'\n '\"%ROOT%\\app\\resources\\kernel\\SiYuan-Kernel.exe\" %*'\n 'exit /b %ERRORLEVEL%'\n ':noshim'\n '1>&2 echo siyuan: Microsoft Store edition not found'\n 'exit /b 1'\n) | Set-Content \"$shimDir\\siyuan.cmd\"\n"
+ "Data": "siyuan --help\n\n# Check which command is being used\nGet-Command siyuan -All\nwhere.exe siyuan\n"
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
@@ -215,17 +215,76 @@
}
]
},
+ {
+ "ID": "20261006133358-auz3ewz",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20261006133358-auz3ewz",
+ "updated": "20261006133358"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "If the command is unavailable, check that the SiYuan app execution alias is enabled in Windows and "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "code",
+ "TextMarkTextContent": "%LOCALAPPDATA%\\Microsoft\\WindowsApps"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " is in "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "code",
+ "TextMarkTextContent": "PATH"
+ },
+ {
+ "Type": "NodeText",
+ "Data": ". The commands above show command resolution; multiple SiYuan editions or "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "code",
+ "TextMarkTextContent": "PATH"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " order may select another executable"
+ }
+ ]
+ },
{
"ID": "20260708130000-enuninst",
"Type": "NodeParagraph",
"Properties": {
"id": "20260708130000-enuninst",
- "updated": "20260708130000"
+ "updated": "20261006133358"
},
"Children": [
{
"Type": "NodeText",
- "Data": "To remove on uninstall: "
+ "Data": "If you created the old "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "code",
+ "TextMarkTextContent": "siyuan.cmd"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " shim, first verify the Store alias directly with "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "code",
+ "TextMarkTextContent": "& \"$env:LOCALAPPDATA\\Microsoft\\WindowsApps\\siyuan.exe\" --help"
+ },
+ {
+ "Type": "NodeText",
+ "Data": ", then optionally remove the shim: "
},
{
"Type": "NodeTextMark",
diff --git a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20260612191136-feqbi1x.sy b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20260612191136-feqbi1x.sy
index 0185925a5d..80ec2e24ab 100644
--- a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20260612191136-feqbi1x.sy
+++ b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20260612191136-feqbi1x.sy
@@ -6,7 +6,7 @@
"id": "20260612191136-feqbi1x",
"title": "命令行接口",
"type": "doc",
- "updated": "20260913020024"
+ "updated": "20261006133358"
},
"Children": [
{
@@ -67,7 +67,7 @@
"HeadingLevel": 2,
"Properties": {
"id": "20260618123536-f5newid",
- "updated": "20260618123536"
+ "updated": "20261006133358"
},
"Children": [
{
@@ -114,7 +114,7 @@
"ListData": {},
"Properties": {
"id": "20260618123536-fdlw82f",
- "updated": "20260618123536"
+ "updated": "20261006133358"
},
"Children": [
{
@@ -126,7 +126,7 @@
},
"Properties": {
"id": "20260618123536-lkzcvp0",
- "updated": "20260618123536"
+ "updated": "20261006133358"
},
"Children": [
{
@@ -134,7 +134,7 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20260618123536-n29x52o",
- "updated": "20260618123536"
+ "updated": "20261006133358"
},
"Children": [
{
@@ -166,25 +166,25 @@
},
{
"Type": "NodeText",
- "Data": "。微软商店版运行在 MSIX 沙箱中,无法自动修改 "
+ "Data": "。微软商店版(3.8.7 及以上)在 Windows 10 1607(内部版本 14393)及以上系统中注册 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
- "TextMarkTextContent": "PATH"
+ "TextMarkTextContent": "siyuan.exe"
},
{
"Type": "NodeText",
- "Data": "​。可部署一个 "
+ "Data": "​ 应用执行别名。安装或更新后,打开新的终端并运行 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
- "TextMarkTextContent": "siyuan.cmd"
+ "TextMarkTextContent": "siyuan --help"
},
{
"Type": "NodeText",
- "Data": "​ 转发器(一次性,商店版更新后依然有效)"
+ "Data": "​"
}
]
},
@@ -194,7 +194,7 @@
"IsFencedCodeBlock": true,
"Properties": {
"id": "20260708121000-cnstore1",
- "updated": "20260708121000"
+ "updated": "20261006133358"
},
"Children": [
{
@@ -207,7 +207,7 @@
},
{
"Type": "NodeCodeBlockCode",
- "Data": "# 仅适用于微软商店版 —— 在 PowerShell 中运行一次\n$shimDir = \"$env:LOCALAPPDATA\\Microsoft\\WindowsApps\" # 该目录默认已在 PATH 中\n@(\n '@echo off'\n 'setlocal'\n 'set \"ROOT=\"'\n 'for /f \"delims=\" %%i in (''powershell -NoProfile -Command \"(Get-AppxPackage *SiYuan*).InstallLocation\"'') do set \"ROOT=%%i\"'\n 'if not defined ROOT goto :noshim'\n '\"%ROOT%\\app\\resources\\kernel\\SiYuan-Kernel.exe\" %*'\n 'exit /b %ERRORLEVEL%'\n ':noshim'\n '1>&2 echo siyuan: 未找到微软商店版'\n 'exit /b 1'\n) | Set-Content \"$shimDir\\siyuan.cmd\"\n"
+ "Data": "siyuan --help\n\n# 检查实际使用的命令\nGet-Command siyuan -All\nwhere.exe siyuan\n"
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
@@ -215,17 +215,76 @@
}
]
},
+ {
+ "ID": "20261006133358-v3b716p",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20261006133358-v3b716p",
+ "updated": "20261006133358"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "如果找不到命令,请检查 Windows 中思源的应用执行别名是否已启用,以及 "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "code",
+ "TextMarkTextContent": "%LOCALAPPDATA%\\Microsoft\\WindowsApps"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " 是否在 "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "code",
+ "TextMarkTextContent": "PATH"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " 中。上述命令可检查命令解析结果;同时安装多个思源版本或 "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "code",
+ "TextMarkTextContent": "PATH"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " 顺序可能导致调用其他可执行文件"
+ }
+ ]
+ },
{
"ID": "20260708130000-cnuninst",
"Type": "NodeParagraph",
"Properties": {
"id": "20260708130000-cnuninst",
- "updated": "20260708130000"
+ "updated": "20261006133358"
},
"Children": [
{
"Type": "NodeText",
- "Data": "卸载商店版时如需清理:"
+ "Data": "如果曾创建旧的 "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "code",
+ "TextMarkTextContent": "siyuan.cmd"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " 转发器,请先运行 "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "code",
+ "TextMarkTextContent": "& \"$env:LOCALAPPDATA\\Microsoft\\WindowsApps\\siyuan.exe\" --help"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " 确认商店版别名可用,再按需删除转发器:"
},
{
"Type": "NodeTextMark",
diff --git a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20260612191214-ymtlxn2.sy b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20260612191214-ymtlxn2.sy
index 85b5c30542..c48056d858 100644
--- a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20260612191214-ymtlxn2.sy
+++ b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20260612191214-ymtlxn2.sy
@@ -6,7 +6,7 @@
"id": "20260612191214-ymtlxn2",
"title": "命令列",
"type": "doc",
- "updated": "20260913020024"
+ "updated": "20261006133358"
},
"Children": [
{
@@ -67,7 +67,7 @@
"HeadingLevel": 2,
"Properties": {
"id": "20260618123823-9n2h06a",
- "updated": "20260618123823"
+ "updated": "20261006133358"
},
"Children": [
{
@@ -114,7 +114,7 @@
"ListData": {},
"Properties": {
"id": "20260618123823-gwobglg",
- "updated": "20260618123823"
+ "updated": "20261006133358"
},
"Children": [
{
@@ -126,7 +126,7 @@
},
"Properties": {
"id": "20260618123823-pg296go",
- "updated": "20260618123823"
+ "updated": "20261006133358"
},
"Children": [
{
@@ -134,7 +134,7 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20260618123823-dsraz6n",
- "updated": "20260618123823"
+ "updated": "20261006133358"
},
"Children": [
{
@@ -166,25 +166,25 @@
},
{
"Type": "NodeText",
- "Data": "。Microsoft Store 版本執行於 MSIX 沙箱中,無法自動修改 "
+ "Data": "。Microsoft Store 版(3.8.7 及以上)在 Windows 10 1607(組建 14393)及以上系統中註冊 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
- "TextMarkTextContent": "PATH"
+ "TextMarkTextContent": "siyuan.exe"
},
{
"Type": "NodeText",
- "Data": "​。可部署一個 "
+ "Data": "​ 應用程式執行別名。安裝或更新後,開啟新的終端機並執行 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
- "TextMarkTextContent": "siyuan.cmd"
+ "TextMarkTextContent": "siyuan --help"
},
{
"Type": "NodeText",
- "Data": "​ 轉發器(一次性,商店版更新後依然有效)"
+ "Data": "​"
}
]
},
@@ -194,7 +194,7 @@
"IsFencedCodeBlock": true,
"Properties": {
"id": "20260708122000-twstore1",
- "updated": "20260708122000"
+ "updated": "20261006133358"
},
"Children": [
{
@@ -207,7 +207,7 @@
},
{
"Type": "NodeCodeBlockCode",
- "Data": "# 僅適用於 Microsoft Store 版 —— 在 PowerShell 中執行一次\n$shimDir = \"$env:LOCALAPPDATA\\Microsoft\\WindowsApps\" # 該目錄預設已在 PATH 中\n@(\n '@echo off'\n 'setlocal'\n 'set \"ROOT=\"'\n 'for /f \"delims=\" %%i in (''powershell -NoProfile -Command \"(Get-AppxPackage *SiYuan*).InstallLocation\"'') do set \"ROOT=%%i\"'\n 'if not defined ROOT goto :noshim'\n '\"%ROOT%\\app\\resources\\kernel\\SiYuan-Kernel.exe\" %*'\n 'exit /b %ERRORLEVEL%'\n ':noshim'\n '1>&2 echo siyuan: 找不到 Microsoft Store 版本'\n 'exit /b 1'\n) | Set-Content \"$shimDir\\siyuan.cmd\"\n"
+ "Data": "siyuan --help\n\n# 檢查實際使用的命令\nGet-Command siyuan -All\nwhere.exe siyuan\n"
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
@@ -215,17 +215,76 @@
}
]
},
+ {
+ "ID": "20261006133358-uu0ne7i",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20261006133358-uu0ne7i",
+ "updated": "20261006133358"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "如果找不到命令,請檢查 Windows 中思源的應用程式執行別名是否已啟用,以及 "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "code",
+ "TextMarkTextContent": "%LOCALAPPDATA%\\Microsoft\\WindowsApps"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " 是否在 "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "code",
+ "TextMarkTextContent": "PATH"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " 中。上述命令可檢查命令解析結果;同時安裝多個思源版本或 "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "code",
+ "TextMarkTextContent": "PATH"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " 順序可能導致呼叫其他可執行檔"
+ }
+ ]
+ },
{
"ID": "20260708130000-twuninst",
"Type": "NodeParagraph",
"Properties": {
"id": "20260708130000-twuninst",
- "updated": "20260708130000"
+ "updated": "20261006133358"
},
"Children": [
{
"Type": "NodeText",
- "Data": "解除安裝商店版時如需清理:"
+ "Data": "如果曾建立舊的 "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "code",
+ "TextMarkTextContent": "siyuan.cmd"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " 轉發器,請先執行 "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "code",
+ "TextMarkTextContent": "& \"$env:LOCALAPPDATA\\Microsoft\\WindowsApps\\siyuan.exe\" --help"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " 確認商店版別名可用,再視需要刪除轉發器:"
},
{
"Type": "NodeTextMark",
diff --git a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20260612192417-fb4ueux.sy b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20260612192417-fb4ueux.sy
index ec8416004b..2fcc50c342 100644
--- a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20260612192417-fb4ueux.sy
+++ b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20260612192417-fb4ueux.sy
@@ -6,7 +6,7 @@
"id": "20260612192417-fb4ueux",
"title": "コマンドラインインターフェース",
"type": "doc",
- "updated": "20260914195107"
+ "updated": "20261006133358"
},
"Children": [
{
@@ -67,7 +67,7 @@
"HeadingLevel": 2,
"Properties": {
"id": "20260618123956-rq5ibw3",
- "updated": "20260618123956"
+ "updated": "20261006133358"
},
"Children": [
{
@@ -114,7 +114,7 @@
"ListData": {},
"Properties": {
"id": "20260618123956-6xjq4tq",
- "updated": "20260618123956"
+ "updated": "20261006133358"
},
"Children": [
{
@@ -126,7 +126,7 @@
},
"Properties": {
"id": "20260618123956-69ywnmy",
- "updated": "20260618123956"
+ "updated": "20261006133358"
},
"Children": [
{
@@ -134,7 +134,7 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20260618123956-8m4ikg3",
- "updated": "20260618123956"
+ "updated": "20261006133358"
},
"Children": [
{
@@ -166,25 +166,25 @@
},
{
"Type": "NodeText",
- "Data": "。Microsoft Store 版は MSIX サンドボックスで実行されるため "
+ "Data": "。Microsoft Store 版(3.8.7 以降)は Windows 10 1607(ビルド 14393)以降で "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
- "TextMarkTextContent": "PATH"
+ "TextMarkTextContent": "siyuan.exe"
},
{
"Type": "NodeText",
- "Data": "​ を自動的に変更できません。"
+ "Data": "​ アプリ実行エイリアスを登録します。インストールまたは更新後、新しいターミナルを開いて "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
- "TextMarkTextContent": "siyuan.cmd"
+ "TextMarkTextContent": "siyuan --help"
},
{
"Type": "NodeText",
- "Data": "​ シム(一回のデプロイでストア更新後も有効)を配置できます"
+ "Data": "​ を実行します"
}
]
},
@@ -194,7 +194,7 @@
"IsFencedCodeBlock": true,
"Properties": {
"id": "20260708123000-jastore1",
- "updated": "20260708123000"
+ "updated": "20261006133358"
},
"Children": [
{
@@ -207,7 +207,7 @@
},
{
"Type": "NodeCodeBlockCode",
- "Data": "# Microsoft Store 版のみ — PowerShell で一度実行\n$shimDir = \"$env:LOCALAPPDATA\\Microsoft\\WindowsApps\" # デフォルトで PATH に含まれる\n@(\n '@echo off'\n 'setlocal'\n 'set \"ROOT=\"'\n 'for /f \"delims=\" %%i in (''powershell -NoProfile -Command \"(Get-AppxPackage *SiYuan*).InstallLocation\"'') do set \"ROOT=%%i\"'\n 'if not defined ROOT goto :noshim'\n '\"%ROOT%\\app\\resources\\kernel\\SiYuan-Kernel.exe\" %*'\n 'exit /b %ERRORLEVEL%'\n ':noshim'\n '1>&2 echo siyuan: Microsoft Store 版が見つかりません'\n 'exit /b 1'\n) | Set-Content \"$shimDir\\siyuan.cmd\"\n"
+ "Data": "siyuan --help\n\n# 実際に使用されるコマンドを確認\nGet-Command siyuan -All\nwhere.exe siyuan\n"
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
@@ -215,17 +215,76 @@
}
]
},
+ {
+ "ID": "20261006133358-x1oqbhv",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20261006133358-x1oqbhv",
+ "updated": "20261006133358"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "コマンドが見つからない場合は、Windows で SiYuan のアプリ実行エイリアスが有効になっていることと、"
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "code",
+ "TextMarkTextContent": "%LOCALAPPDATA%\\Microsoft\\WindowsApps"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " が "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "code",
+ "TextMarkTextContent": "PATH"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " に含まれていることを確認してください。上記のコマンドで解決先を確認できます。複数の SiYuan エディションのインストールや "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "code",
+ "TextMarkTextContent": "PATH"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " の順序により、別の実行ファイルが選択される場合があります"
+ }
+ ]
+ },
{
"ID": "20260708130000-jauninst",
"Type": "NodeParagraph",
"Properties": {
"id": "20260708130000-jauninst",
- "updated": "20260708130000"
+ "updated": "20261006133358"
},
"Children": [
{
"Type": "NodeText",
- "Data": "アンインストール時に削除する場合: "
+ "Data": "以前に "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "code",
+ "TextMarkTextContent": "siyuan.cmd"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " シムを作成した場合は、まず "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "code",
+ "TextMarkTextContent": "& \"$env:LOCALAPPDATA\\Microsoft\\WindowsApps\\siyuan.exe\" --help"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " でストア版のエイリアスが動作することを確認し、必要に応じてシムを削除してください:"
},
{
"Type": "NodeTextMark",
diff --git a/app/scripts/appxManifest.test.js b/app/scripts/appxManifest.test.js
new file mode 100644
index 0000000000..35b56e02a4
--- /dev/null
+++ b/app/scripts/appxManifest.test.js
@@ -0,0 +1,49 @@
+const assert = require("node:assert/strict");
+const {readFileSync} = require("node:fs");
+const path = require("node:path");
+const test = require("node:test");
+
+const manifests = [
+ ["AppxManifest.xml", "x64"],
+ ["AppxManifest-arm64.xml", "arm64"],
+];
+
+const attributes = (tag) => Object.fromEntries(
+ Array.from(tag.matchAll(/([\w:]+)="([^"]*)"/g), match => [match[1], match[2]]),
+);
+
+for (const [filename, architecture] of manifests) {
+ const source = readFileSync(path.join(__dirname, "../appx", filename), "utf8");
+
+ test(`${filename} exposes the kernel through a classic desktop CLI alias`, () => {
+ const extensions = Array.from(source.matchAll(/<uap3:Extension\b([^>]*)>([\s\S]*?)<\/uap3:Extension>/g))
+ .filter(match => attributes(match[1]).Category === "windows.appExecutionAlias");
+ assert.equal(extensions.length, 1);
+ const extension = extensions[0];
+ assert.deepEqual(attributes(extension[1]), {
+ Category: "windows.appExecutionAlias",
+ Executable: "app\\resources\\kernel\\SiYuan-Kernel.exe",
+ EntryPoint: "Windows.FullTrustApplication",
+ });
+ assert.match(extension[2], /<uap3:AppExecutionAlias>\s*<desktop:ExecutionAlias\s+Alias="siyuan\.exe"\s*\/>\s*<\/uap3:AppExecutionAlias>/);
+ assert.equal(Array.from(source.matchAll(/\bAlias="siyuan\.exe"/g)).length, 1);
+ });
+
+ test(`${filename} preserves the GUI entry, protocol and package compatibility`, () => {
+ const packageAttributes = attributes(source.match(/<Package\b([^>]*)>/)[1]);
+ assert.equal(packageAttributes["xmlns:uap3"], "http://schemas.microsoft.com/appx/manifest/uap/windows10/3");
+ assert.equal(packageAttributes["xmlns:desktop"], "http://schemas.microsoft.com/appx/manifest/desktop/windows10");
+ const ignorable = packageAttributes.IgnorableNamespaces.split(/\s+/);
+ assert.ok(ignorable.includes("uap3"));
+ assert.ok(ignorable.includes("desktop"));
+ assert.equal(attributes(source.match(/<Identity\b([^>]*)\/>/)[1]).ProcessorArchitecture, architecture);
+ const applications = Array.from(source.matchAll(/<Application\b([^>]*)>/g));
+ assert.equal(applications.length, 1);
+ assert.deepEqual(attributes(applications[0][1]), {
+ Id: "SiYuan", Executable: "app\\SiYuan.exe", EntryPoint: "Windows.FullTrustApplication",
+ });
+ assert.match(source, /<uap:Extension\s+Category="windows\.protocol">\s*<uap:Protocol\s+Name="siyuan"\s*\/>\s*<\/uap:Extension>/);
+ assert.match(source, /<rescap:Capability\s+Name="runFullTrust"\s*\/>/);
+ assert.equal(attributes(source.match(/<TargetDeviceFamily\b([^>]*)\/>/)[1]).MinVersion, "10.0.14316.0");
+ });
+}