Update locale resources.

This commit is contained in:
Bruce
2026-04-09 18:04:40 +08:00
parent 9ba3b875da
commit 84a28db8cf
3 changed files with 617 additions and 255 deletions

View File

@@ -78,6 +78,14 @@ namespace PkgCLI
} }
return sb.ToString ().TrimEnd (Environment.NewLine.ToCharArray ()); return sb.ToString ().TrimEnd (Environment.NewLine.ToCharArray ());
} }
public static string Format (this string format, params object [] args)
{
return String.Format (format, args);
}
public static string Format (this string format, object args)
{
return String.Format (format, args);
}
} }
public static class PackageReaderExt public static class PackageReaderExt
{ {

View File

@@ -23,37 +23,18 @@ namespace PkgCLI
"/h", "/h",
"-h" "-h"
}; };
public static StringResXmlDoc res = new StringResXmlDoc (Path.Combine (AppDomain.CurrentDomain.BaseDirectory, "locale\\pkgcli.xml"));
static bool IsHelpParam (string arg) => helpArgs.Contains (arg.Normalize ()); static bool IsHelpParam (string arg) => helpArgs.Contains (arg.Normalize ());
static void PrintVersion () static void PrintVersion ()
{ {
var verFilePath = Path.Combine (AppDomain.CurrentDomain.BaseDirectory, "version"); var verFilePath = Path.Combine (AppDomain.CurrentDomain.BaseDirectory, "version");
var verFileInst = new _I_File (verFilePath); var verFileInst = new _I_File (verFilePath);
var verstr = verFileInst.Content?.Trim () ?? "0.0.0.1"; var verstr = verFileInst.Content?.Trim () ?? "0.0.0.1";
Console.WriteLine ( Console.WriteLine (String.Format (res.Get ("PKGCLI_VERSION"), verstr));
$"Package Manager CLI [Version {verstr}]\n(C) Windows Modern. All rights reserved."
);
} }
static void PrintTotalHelp () static void PrintTotalHelp ()
{ {
Console.WriteLine (@" Console.WriteLine (res.Get ("PKGCLI_TOTALHELP"));
Usage:
pkgcli <command> [arguments]
Commands:
/install Install a package.
/update Update a package (previous version must be installed).
/register Register an app manifest file.
/stage Stage a package.
/remove Remove the package.
/read Read package information.
/get List all installed apps.
/find Find installed apps.
/active Launch an app.
/config Configure settings (omit to show current config).
/version Display version information.
/encoding Set console output encoding. With other commands.
/? Show this help.
");
} }
public static bool IsFilePathInList (List<string> filelist, string file) public static bool IsFilePathInList (List<string> filelist, string file)
{ {
@@ -339,28 +320,7 @@ Commands:
if (CliPasingUtils.ParamContains (cmds, "help")) if (CliPasingUtils.ParamContains (cmds, "help"))
{ {
PrintVersion (); PrintVersion ();
Console.WriteLine (@" Console.WriteLine (res.Get ("PKGCLI_HELP_ENCODING"));
Usage:
pkgcli /encoding:<code_page|name>
pkgcli /en:<code_page|name>
Operation:
Set the console output encoding for the current session.
Useful when the output contains non-ASCII characters.
Arguments:
<code_page> Numeric code page identifier (e.g., 65001 for UTF-8, 936 for GB2312).
<name> Encoding name (e.g., utf-8, gb2312, windows-1252).
Examples:
pkgcli /encoding:65001 (Set to UTF-8)
pkgcli /encoding:utf-8
pkgcli /en:936 (Set to GB2312/GBK)
pkgcli /en:gb2312
Note:
This setting only affects the current pkgcli process and does not persist.
");
return; return;
} }
#endregion #endregion
@@ -378,7 +338,7 @@ Note:
catch (Exception ex) catch (Exception ex)
{ {
Console.ForegroundColor = ConsoleColor.Yellow; Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine ($"Warning: Set encoding for output failed. Exception {ex.GetType ()}\nMessage: \n {ex.Message}\nWe will use default encoding."); Console.WriteLine (String.Format (res.Get ("PKGCLI_WARNING_ENCODING"), ex.GetType (), ex.Message));
Console.ResetColor (); Console.ResetColor ();
} }
} }
@@ -388,33 +348,7 @@ Note:
PrintVersion (); PrintVersion ();
if (CliPasingUtils.ParamContains (cmds, "help")) if (CliPasingUtils.ParamContains (cmds, "help"))
{ {
Console.WriteLine (@" Console.WriteLine (res.Get ("PKGCLI_HELP_IRUS"));
Usage:
pkgcli <command> <file_path...> [/developmode] [/force] [/allres]
Commands:
/install Install a package. Supports .appx, .appxbundle, .msix, .msixbundle.
/register Register a package. Supports AppxManifest.xml or *.appxmanifest.
/update Update an installed app. Supports same formats as /install.
/stage Stage a package (pre-deploy). Supports same formats as /install.
Options (DeploymentOptions flags):
/developmode Install/register in development mode. Do not use with bundle packages.
/force Force application shutdown to allow registration when the package or its dependencies are in use.
/allres Skip resource applicability checks; stage/register all resource packages in a bundle.
Arguments:
<file_path...> One or more package or manifest file paths. Can be:
- Direct path to .appx, .msix, .appxbundle, .msixbundle, or .xml manifest.
- A .txt file containing a list of such paths (one per line).
- If no command is repeated, the command applies to all listed files.
Examples:
pkgcli /install MyApp.appx
pkgcli /register /manifest:AppxManifest.xml /developmode
pkgcli /update MyApp.msixbundle /force
pkgcli /stage MyApp.appx /allres
");
return; return;
} }
#endregion #endregion
@@ -468,7 +402,7 @@ Examples:
{ {
Console.WriteLine (); Console.WriteLine ();
var file = totallist [i]; var file = totallist [i];
Console.Write ($"\r({i + 1}/{totallist.Count}) Operation in progress..."); Console.Write ("\r" + String.Format (res.Get ("PKGCLI_PROGRESS_OPERATION"), i + 1, totallist.Count));
var hr = new _I_HResult (0); var hr = new _I_HResult (0);
var tempope = ope; var tempope = ope;
if (file.Item1 == 1) if (file.Item1 == 1)
@@ -476,17 +410,17 @@ Examples:
if (cmds.ParamContains ("register")) tempope = RegisterPackageByFullName; if (cmds.ParamContains ("register")) tempope = RegisterPackageByFullName;
} }
hr = tempope (file.Item2, null, options, prog => { hr = tempope (file.Item2, null, options, prog => {
var str = $"\r({i + 1}/{filelist.Count}) Operation in progress... {prog}% of {(int)((i + prog * 0.01) / filelist.Count * 100)}%"; var str = "\r" + String.Format (res.Get ("PKGCLI_PROGRESS_OPERATION_WITHPROGRESS"), i + 1, totallist.Count, prog, (int)((i + prog * 0.01) / totallist.Count * 100));
Console.Write (str); Console.Write (str);
}); });
if (hr.Failed) if (hr.Failed)
{ {
Console.ForegroundColor = ConsoleColor.Red; Console.ForegroundColor = ConsoleColor.Red;
Console.Write ($"\nPackage {i + 1} \"{file.Item2}\" Operation Error ({"0x" + hr.HResult.ToString ("X8")}): \n{hr.Message}"); Console.Write ("\n" + String.Format (res.Get ("PKGCLI_ERROR_IRUS_EXCEPTION"), i + 1, file.Item2, "0x" + hr.HResult.ToString ("X8"), hr.Message));
Console.ResetColor (); Console.ResetColor ();
} }
} }
Console.WriteLine ("\nAll Done."); Console.WriteLine ("\n" + res.Get ("PKGCLI_COMPLETE_OPERATION"));
return; return;
} }
else if (cmds.ParamsContainsOr ("remove")) else if (cmds.ParamsContainsOr ("remove"))
@@ -495,28 +429,7 @@ Examples:
if (CliPasingUtils.ParamContains (cmds, "help")) if (CliPasingUtils.ParamContains (cmds, "help"))
{ {
PrintVersion (); PrintVersion ();
Console.WriteLine (@" Console.WriteLine (res.Get ("PKGCLI_HELP_REMOVE"));
Usage:
pkgcli /remove <package_full_name> [<package_full_name>...] [/yes]
Operation:
Remove one or more packages.
Arguments:
<package_full_name> The full name of the installed package.
Format: <identity_name>_<version>_<architecture>_<resource_id>_<publisher_id>
Example: Microsoft.WinJS.1.0_1.0.9200.20789_neutral__8wekyb3d8bbwe
Options:
/yes Automatically confirm the uninstallation without prompting.
Aliases: /y, /agree
You can specify multiple full names separated by spaces.
Examples:
pkgcli /remove MyPackage_1.0.0.0_x64__abcd1234
pkgcli /remove PackageA_1.0.0.0_neutral__abcd1234 PackageB_2.0.0.0_x86__efgh5678 /yes
");
return; return;
} }
#endregion #endregion
@@ -536,30 +449,30 @@ Examples:
if (list.Count <= 0) agree = true; if (list.Count <= 0) agree = true;
else else
{ {
Console.Write ($"We will uninstall {list.Count} app(-s). Do you want to continue?(Y/N) "); Console.Write (String.Format (res.Get ("PKGCLI_ASK_REMOVE"), list.Count));
var userinput = Console.ReadLine (); var userinput = Console.ReadLine ();
if (userinput.NEquals ("y") || userinput.NEquals ("yes")) agree = true; if (userinput.NEquals ("y") || userinput.NEquals ("yes")) agree = true;
else agree = false; else agree = false;
} }
} }
if (agree == false) throw new OperationCanceledException ("User canceled."); if (agree == false) throw new OperationCanceledException (res.Get ("PKGCLI_ERROR_USERABORT"));
for (int i = 0; i < list.Count; i++) for (int i = 0; i < list.Count; i++)
{ {
Console.WriteLine (); Console.WriteLine ();
var file = list [i]; var file = list [i];
Console.Write ($"\r({i + 1}/{list.Count}) Operation in progress..."); Console.Write ("\r" + String.Format (res.Get ("PKGCLI_PROGRESS_OPERATION"), i + 1, list.Count));
var hr = RemovePackage (file, prog => { var hr = RemovePackage (file, prog => {
var str = $"\r({i + 1}/{list.Count}) Operation in progress... {prog}% of {(int)((i + prog * 0.01) / list.Count * 100)}%"; var str = "\r" + String.Format (res.Get ("PKGCLI_PROGRESS_OPERATION_WITHPROGRESS"), i + 1, list.Count, prog, (int)((i + prog * 0.01) / list.Count * 100));
Console.Write (str); Console.Write (str);
}); });
if (hr.Failed) if (hr.Failed)
{ {
Console.ForegroundColor = ConsoleColor.Red; Console.ForegroundColor = ConsoleColor.Red;
Console.Write ($"\nPackage {i + 1} \"{file}\" Operation Error ({"0x" + hr.HResult.ToString ("X8")}): \n{hr.Message}"); Console.Write ("\n" + String.Format (res.Get ("PKGCLI_ERROR_IRUS_EXCEPTION"), i + 1, file, "0x" + hr.HResult.ToString ("X8"), hr.Message));
Console.ResetColor (); Console.ResetColor ();
} }
} }
Console.WriteLine ("\nAll Done."); Console.WriteLine ("\n" + res.Get ("PKGCLI_COMPLETE_OPERATION"));
return; return;
} }
else if (cmds.ParamsContainsOr ("get")) else if (cmds.ParamsContainsOr ("get"))
@@ -568,30 +481,7 @@ Examples:
if (CliPasingUtils.ParamContains (cmds, "help")) if (CliPasingUtils.ParamContains (cmds, "help"))
{ {
PrintVersion (); PrintVersion ();
Console.WriteLine (@" Console.WriteLine (res.Get ("PKGCLI_HELP_GET"));
Usage:
pkgcli /get [/filter:<filter1,filter2,...>]
Operation:
List all installed packages with their properties.
Options:
/filter:<filters> Show only the specified properties.
Filters are case-insensitive and support '*' wildcard.
Multiple filters separated by comma ',' or semicolon ';'.
Examples:
/filter:Identity:Name,Identity:Version
/filter:Identity:* (all Identity properties)
/filter:Properties:DisplayName
Output:
Each package is printed as a section [FullName] followed by key = value lines.
Redirect output to a file to save as INI-like format.
Examples:
pkgcli /get
pkgcli /get /filter:Identity:FullName,Properties:DisplayName
");
return; return;
} }
#endregion #endregion
@@ -611,7 +501,7 @@ Examples:
if (hr.Item1.Failed) if (hr.Item1.Failed)
{ {
Console.ForegroundColor = ConsoleColor.Red; Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine ($"Operation Error ({"0x" + hr.Item1.HResult.ToString ("X8")}): \n{hr.Item1.Message}"); Console.WriteLine (String.Format (res.Get ("PKGCLI_ERROR_EXCEPTION"), "0x" + hr.Item1.HResult.ToString ("X8"), hr.Item1.Message));
Console.ResetColor (); Console.ResetColor ();
return; return;
} }
@@ -630,28 +520,7 @@ Examples:
if (CliPasingUtils.ParamContains (cmds, "help")) if (CliPasingUtils.ParamContains (cmds, "help"))
{ {
PrintVersion (); PrintVersion ();
Console.WriteLine(@" Console.WriteLine (res.Get ("PKGCLI_HELP_FIND"));
Usage:
pkgcli /find <package_full_name|package_family_name> [/filter:<filters>]
pkgcli /find <identity_name> <identity_publisher> [/filter:<filters>]
Operation:
Find installed packages matching the given identifier.
Arguments:
<package_full_name> Full name of a package.
<package_family_name> Family name of a package.
<identity_name> Name part of the package identity (e.g., ""Microsoft.WindowsStore"").
<identity_publisher> Publisher part (e.g., ""CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US"").
Options:
/filter:<filters> Same as in /get command.
Examples:
pkgcli /find Microsoft.WindowsStore_8wekyb3d8bbwe!App
pkgcli /find Microsoft.WindowsStore
pkgcli /find Microsoft.WindowsStore ""CN=Microsoft Corporation, ...""
");
return; return;
} }
#endregion #endregion
@@ -715,24 +584,7 @@ Examples:
if (CliPasingUtils.ParamContains (cmds, "help")) if (CliPasingUtils.ParamContains (cmds, "help"))
{ {
PrintVersion (); PrintVersion ();
Console.WriteLine (@" Console.WriteLine (res.Get ("PKGCLI_HELP_ACTIVATE"));
Usage:
pkgcli /active <app_user_model_id> [arguments]
Operation:
Launch (activate) a Universal Windows Platform (UWP) app.
Arguments:
<app_user_model_id> The Application User Model ID (AUMID).
Format: <package_family_name>!<app_id>
Example: Microsoft.WindowsStore_8wekyb3d8bbwe!App
[arguments] Optional command-line arguments passed to the app.
Examples:
pkgcli /active Microsoft.WindowsStore_8wekyb3d8bbwe!App
pkgcli /active MyAppFamily!App --fullscreen --debug
");
return; return;
} }
#endregion #endregion
@@ -747,11 +599,11 @@ Examples:
if (args [i].NNormalize ().IndexOf (c.Value.NNormalize ()) >= 0) break; if (args [i].NNormalize ().IndexOf (c.Value.NNormalize ()) >= 0) break;
} }
var hr = ActiveApp (c.Value, BuildCommandLine (args, i + 1)); var hr = ActiveApp (c.Value, BuildCommandLine (args, i + 1));
if (hr.Succeeded) Console.WriteLine ("Done."); if (hr.Succeeded) Console.WriteLine (res.Get ("PKGCLI_COMPLETE_DONE"));
else else
{ {
Console.ForegroundColor = ConsoleColor.Red; Console.ForegroundColor = ConsoleColor.Red;
Console.Write ($"Operation Error ({"0x" + hr.HResult.ToString ("X8")}): \n{hr.Message}"); Console.Write (String.Format (res.Get ("PKGCLI_ERROR_EXCEPTION"), "0x" + hr.HResult.ToString ("X8"), hr.Message));
Console.ResetColor (); Console.ResetColor ();
} }
return; return;
@@ -765,54 +617,7 @@ Examples:
if (CliPasingUtils.ParamContains (cmds, "help")) if (CliPasingUtils.ParamContains (cmds, "help"))
{ {
PrintVersion (); PrintVersion ();
Console.WriteLine (@" Console.WriteLine (res.Get ("PKGCLI_HELP_READ"));
Usage:
pkgcli /read [options] [<file>]
Description:
Read an Appx/MSIX package (.appx, .appxbundle, .msix, .msixbundle) or its manifest file (.xml, .appxpackage, .msixpackage).
Extracts package/manifest information and outputs as JSON to the console, or saves as a ZIP archive containing either info.json or info.xml.
Options:
/manifest:<file> Specify a manifest file to read.
/package:<file> Specify a package file to read.
<file> If no /manifest or /package is provided, the first unnamed parameter is used as the input file.
File type is auto-detected by extension:
.xml, .appxpackage, .msixpackage → ManifestReader
.appx, .appxbundle, .msix, .msixbundle → PackageReader
/item:<path> Instead of outputting the whole JSON object, output only the value at the given path.
Path syntax: use '.' or ':' as separators, case-insensitive.
Supports indexers (e.g., [0]), .length for collections, and automatic Base64 access (e.g., LogoBase64).
Examples:
/item:Identity.Name
/item:Properties.Publisher
/item:applications[0]
/item:applications.length
/item:applications[0].LogoBase64
/usepri Enable PRI resource resolution (localization and scaled images). Required for proper resource string and image resolution.
/savexml:<output> Save extracted data as an XML file wrapped in a ZIP archive.
The archive will contain an info.xml file with the structured data.
/savejson:<output> Save extracted data as a JSON file wrapped in a ZIP archive.
The archive will contain an info.json file with the structured data.
/help Display this help text.
Output Behavior:
- If neither /savexml nor /savejson is given, the information is printed directly to the console as JSON.
- If /item is used, only the value at the specified path is printed (as a string, version, or formatted JSON).
- If /savexml or /savejson is used, the data is saved to the specified file (ZIP archive) and a success/failure message is shown.
Examples:
pkgcli /read MyApp.appx
pkgcli /read /manifest:AppxManifest.xml /usepri
pkgcli /read /package:MyApp.msixbundle /item:Identity.Name
pkgcli /read /package:MyApp.appx /savejson:output.zip
pkgcli /read MyApp.appx /item:applications[0].DisplayName
");
return; return;
} }
#endregion #endregion
@@ -954,26 +759,7 @@ Examples:
if (CliPasingUtils.ParamContains (cmds, "help")) if (CliPasingUtils.ParamContains (cmds, "help"))
{ {
PrintVersion (); PrintVersion ();
Console.WriteLine (@" Console.WriteLine (res.Get ("PKGCLI_HELP_CONFIG"));
Usage:
pkgcli /config Show current configuration (all keys).
pkgcli /config /show:<key> Show value of a specific configuration key.
pkgcli /config /set:<key> <value> Set configuration key to the given value.
pkgcli /config /refresh Reload configuration from config.ini.
Configuration keys:
AppMetadataItems Comma-separated list of application metadata fields to read from manifests.
Default: ""Id,BackgroundColor,DisplayName,ForegroundText,ShortName,SmallLogo,Square44x44Logo""
Configuration file:
config.ini in the same directory as pkgcli.exe.
Examples:
pkgcli /config
pkgcli /config /show:AppMetadataItems
pkgcli /config /set:AppMetadataItems ""Id,DisplayName,Logo""
pkgcli /config /refresh
");
return; return;
} }
#endregion #endregion
@@ -984,7 +770,7 @@ Examples:
{ {
var cmd = cmds.GetFromId ("set"); var cmd = cmds.GetFromId ("set");
var key = cmd.Value; var key = cmd.Value;
if (string.IsNullOrWhiteSpace (key)) throw new InvalidOperationException ($"key is empty"); if (string.IsNullOrWhiteSpace (key)) throw new InvalidOperationException (Program.res.Get ("PKGCLI_ERROR_KEYSTRINGEMPTY"));
var isfind = false; var isfind = false;
foreach (var i in configItems) foreach (var i in configItems)
{ {
@@ -994,7 +780,7 @@ Examples:
break; break;
} }
} }
if (!isfind) throw new KeyNotFoundException ($"Error: cannot find the key \"{key}\""); if (!isfind) throw new KeyNotFoundException (String.Format (Program.res.Get("PKGCLI_ERROR_CANNOTFINDKEY"), key));
var valuelist = new List<string> (); var valuelist = new List<string> ();
foreach (var c in cmds) foreach (var c in cmds)
{ {
@@ -1032,7 +818,7 @@ Examples:
break; break;
} }
} }
if (!isfind) throw new KeyNotFoundException ($"Error: cannot find the key \"{key}\""); if (!isfind) throw new KeyNotFoundException (String.Format (Program.res.Get ("PKGCLI_ERROR_CANNOTFINDKEY"), key));
var value = sSettings.GetKey ($"PkgCLI:{key.Trim ()}").ReadString ("(use default)"); var value = sSettings.GetKey ($"PkgCLI:{key.Trim ()}").ReadString ("(use default)");
Console.WriteLine (value); Console.WriteLine (value);
} }
@@ -1044,18 +830,7 @@ Examples:
if (CliPasingUtils.ParamContains (cmds, "help")) if (CliPasingUtils.ParamContains (cmds, "help"))
{ {
PrintVersion (); PrintVersion ();
Console.WriteLine (@" Console.WriteLine (res.Get ("PKGCLI_HELP_VERSION"));
Usage:
pkgcli /version
pkgcli /ver
Operation:
Display the current version of Package Manager CLI.
Examples:
pkgcli /version
pkgcli /ver
");
return; return;
} }
#endregion #endregion
@@ -1072,7 +847,7 @@ Examples:
catch (Exception ex) catch (Exception ex)
{ {
Console.ForegroundColor = ConsoleColor.Red; Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine ($"Exception {ex.GetType ()}, \nMessage: \n {ex.Message}\nStack: \n {ex.StackTrace}"); Console.WriteLine (String.Format (res.Get ("PKGCLI_ERROR_FINALEXCEPTION"), ex.GetType (), ex.Message, ex.StackTrace));
} }
finally finally
{ {

579
shared/locale/pkgcli.xml Normal file
View File

@@ -0,0 +1,579 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<resource id="PKGCLI_VERSION">
<lang name="zh-CN"><![CDATA[Package Manager CLI [版本 {0}]
(C) Windows Modern。保留所有权利。]]></lang>
<lang name="en-US"><![CDATA[Package Manager CLI [Version {0}]
(C) Windows Modern. All rights reserved.]]></lang>
</resource>
<resource id="PKGCLI_TOTALHELP">
<lang name="zh-CN"><![CDATA[
用法:
pkgcli <命令> [参数列表]
命令:
/install 安装一个包。
/update 更新一个包(必须已安装旧版本)。
/register 注册一个应用程序清单文件。
/stage 暂存一个包。
/remove 移除包。
/read 读取包信息。
/get 列出所有已安装的应用。
/find 查找已安装的应用。
/active 启动一个应用。
/config 配置设置。
/version 显示版本信息。
/encoding 设置控制台输出编码。可与其他命令一起使用。
/? 显示本帮助信息。
您可以使用“pkgcli <命令> /?”来获取有关该命令的详细信息。
]]></lang>
<lang name="en-US"><![CDATA[
Usage:
pkgcli <command> [arguments]
Commands:
/install Install a package.
/update Update a package (previous version must be installed).
/register Register an app manifest file.
/stage Stage a package.
/remove Remove the package.
/read Read package information.
/get List all installed apps.
/find Find installed apps.
/active Launch an app.
/config Configure settings.
/version Display version information.
/encoding Set console output encoding. With other commands.
/? Show this help.
You can use "pkgcli <command> /?" to get the detail infomation about this command.
]]></lang>
</resource>
<resource id="PKGCLI_HELP_ENCODING">
<lang name="zh-CN"><![CDATA[
用法:
pkgcli /encoding:<代码页|名称>
pkgcli /en:<代码页|名称>
操作说明:
为当前会话设置控制台输出编码。
当输出内容包含非 ASCII 字符时非常有用。
参数:
<代码页> 数字代码页标识符(例如 65001 表示 UTF-8936 表示 GB2312
<名称> 编码名称(例如 utf-8、gb2312、windows-1252
示例:
pkgcli /encoding:65001 (设置为 UTF-8
pkgcli /encoding:utf-8
pkgcli /en:936 (设置为 GB2312/GBK
pkgcli /en:gb2312
注意:
此设置仅影响当前 pkgcli 进程,不会持久保存。
]]></lang>
<lang name="en-US"><![CDATA[
Usage:
pkgcli /encoding:<code_page|name>
pkgcli /en:<code_page|name>
Operation:
Set the console output encoding for the current session.
Useful when the output contains non-ASCII characters.
Arguments:
<code_page> Numeric code page identifier (e.g., 65001 for UTF-8, 936 for GB2312).
<name> Encoding name (e.g., utf-8, gb2312, windows-1252).
Examples:
pkgcli /encoding:65001 (Set to UTF-8)
pkgcli /encoding:utf-8
pkgcli /en:936 (Set to GB2312/GBK)
pkgcli /en:gb2312
Note:
This setting only affects the current pkgcli process and does not persist.
]]></lang>
</resource>
<resource id="PKGCLI_HELP_IRUS">
<lang name="zh-CN"><![CDATA[
用法:
pkgcli <命令> <文件路径...> [/developmode] [/force] [/allres]
命令:
/install 安装一个包。支持 .appx、.appxbundle、.msix、.msixbundle。
/register 注册一个包。支持 AppxManifest.xml 或 *.appxmanifest。
/update 更新已安装的应用。支持的格式与 /install 相同。
/stage 暂存一个包(预部署)。支持的格式与 /install 相同。
选项(部署选项标志):
/developmode 以开发模式安装/注册。请勿与捆绑包一起使用。
/force 当包或其依赖项正在使用时,强制关闭应用程序以允许注册。
/allres 跳过资源适用性检查;暂存/注册捆绑包中的所有资源包。
参数:
<文件路径...> 一个或多个包或清单文件路径。可以是:
- 直接指向 .appx、.msix、.appxbundle、.msixbundle 或 .xml 清单的路径。
- 一个包含此类路径列表的 .txt 文件(每行一个路径)。
- 如果命令没有重复,则该命令适用于所有列出的文件。
示例:
pkgcli /install MyApp.appx
pkgcli /register /manifest:AppxManifest.xml /developmode
pkgcli /update MyApp.msixbundle /force
pkgcli /stage MyApp.appx /allres
]]></lang>
<lang name="en-US"><![CDATA[
Usage:
pkgcli <command> <file_path...> [/developmode] [/force] [/allres]
Commands:
/install Install a package. Supports .appx, .appxbundle, .msix, .msixbundle.
/register Register a package. Supports AppxManifest.xml or *.appxmanifest.
/update Update an installed app. Supports same formats as /install.
/stage Stage a package (pre-deploy). Supports same formats as /install.
Options (DeploymentOptions flags):
/developmode Install/register in development mode. Do not use with bundle packages.
/force Force application shutdown to allow registration when the package or its dependencies are in use.
/allres Skip resource applicability checks; stage/register all resource packages in a bundle.
Arguments:
<file_path...> One or more package or manifest file paths. Can be:
- Direct path to .appx, .msix, .appxbundle, .msixbundle, or .xml manifest.
- A .txt file containing a list of such paths (one per line).
- If no command is repeated, the command applies to all listed files.
Examples:
pkgcli /install MyApp.appx
pkgcli /register /manifest:AppxManifest.xml /developmode
pkgcli /update MyApp.msixbundle /force
pkgcli /stage MyApp.appx /allres
]]></lang>
</resource>
<resource id="PKGCLI_HELP_REMOVE">
<lang name="zh-CN"><![CDATA[
用法:
pkgcli /remove <包全名> [<包全名>...] [/yes]
操作说明:
移除一个或多个包。
参数:
<包全名> 已安装包的全名 (Package Full Name)。
格式:<标识名>_<版本号>_<处理器架构>_<资源ID>_<发布者ID>
示例Microsoft.WinJS.1.0_1.0.9200.20789_neutral__8wekyb3d8bbwe
选项:
/yes 自动确认卸载,不进行提示。
别名:/y、/agree
您可以指定多个包全名,用空格分隔。
示例:
pkgcli /remove MyPackage_1.0.0.0_x64__abcd1234
pkgcli /remove PackageA_1.0.0.0_neutral__abcd1234 PackageB_2.0.0.0_x86__efgh5678 /yes
]]></lang>
<lang name="en-US"><![CDATA[
Usage:
pkgcli /remove <package_full_name> [<package_full_name>...] [/yes]
Operation:
Remove one or more packages.
Arguments:
<package_full_name> The full name of the installed package.
Format: <identity_name>_<version>_<architecture>_<resource_id>_<publisher_id>
Example: Microsoft.WinJS.1.0_1.0.9200.20789_neutral__8wekyb3d8bbwe
Options:
/yes Automatically confirm the uninstallation without prompting.
Aliases: /y, /agree
You can specify multiple full names separated by spaces.
Examples:
pkgcli /remove MyPackage_1.0.0.0_x64__abcd1234
pkgcli /remove PackageA_1.0.0.0_neutral__abcd1234 PackageB_2.0.0.0_x86__efgh5678 /yes
]]></lang>
</resource>
<resource id="PKGCLI_HELP_GET">
<lang name="zh-CN"><![CDATA[
用法:
pkgcli /get [/filter:<筛选器1,筛选器2,...>]
操作说明:
列出所有已安装包及其属性。
注意:
若想执行此命令,请以管理员模式运行。
选项:
/filter:<筛选器> 仅显示指定的属性。
筛选器不区分大小写,支持通配符“*”。
多个筛选器用逗号“,”或分号“;”分隔。
示例:
/filter:Identity:Name,Identity:Version
/filter:Identity:* (所有 Identity 属性)
/filter:Properties:DisplayName
输出:
每个包以 [FullName] 节的形式输出,后跟 key = value 行。
可将输出重定向到文件,以保存为类似 INI 的格式。
示例:
pkgcli /get
pkgcli /get /filter:Identity:FullName,Properties:DisplayName
]]></lang>
<lang name="en-US"><![CDATA[
Usage:
pkgcli /get [/filter:<filter1,filter2,...>]
Operation:
List all installed packages with their properties.
Note:
To run this command, please use Administrator mode.
Options:
/filter:<filters> Show only the specified properties.
Filters are case-insensitive and support '*' wildcard.
Multiple filters separated by comma ',' or semicolon ';'.
Examples:
/filter:Identity:Name,Identity:Version
/filter:Identity:* (all Identity properties)
/filter:Properties:DisplayName
Output:
Each package is printed as a section [FullName] followed by key = value lines.
Redirect output to a file to save as INI-like format.
Examples:
pkgcli /get
pkgcli /get /filter:Identity:FullName,Properties:DisplayName
]]></lang>
</resource>
<resource id="PKGCLI_HELP_FIND">
<lang name="zh-CN"><![CDATA[
用法:
pkgcli /find <包全名|包系列名> [/filter:<筛选器>]
pkgcli /find <标识名> <标识发布者> [/filter:<筛选器>]
操作说明:
查找与给定标识符匹配的已安装包。
注意:
若想执行此命令,请以管理员模式运行。
参数:
<包全名> 包的全名。
<包系列名> 包的系列名。
<标识名> 包标识的名称部分(例如 "Microsoft.WindowsStore")。
<标识发布者> 发布者部分(例如 "CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US")。
选项:
/filter:<筛选器> 与 /get 命令中的 /filter 相同。
示例:
pkgcli /find Microsoft.WindowsStore_8wekyb3d8bbwe!App
pkgcli /find Microsoft.WindowsStore
pkgcli /find Microsoft.WindowsStore "CN=Microsoft Corporation, ..."
]]></lang>
<lang name="en-US"><![CDATA[
Usage:
pkgcli /find <package_full_name|package_family_name> [/filter:<filters>]
pkgcli /find <identity_name> <identity_publisher> [/filter:<filters>]
Operation:
Find installed packages matching the given identifier.
Note:
To run this command, please use Administrator mode.
Arguments:
<package_full_name> Full name of a package.
<package_family_name> Family name of a package.
<identity_name> Name part of the package identity (e.g., "Microsoft.WindowsStore").
<identity_publisher> Publisher part (e.g., "CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US").
Options:
/filter:<filters> Same as in /get command.
Examples:
pkgcli /find Microsoft.WindowsStore_8wekyb3d8bbwe!App
pkgcli /find Microsoft.WindowsStore
pkgcli /find Microsoft.WindowsStore "CN=Microsoft Corporation, ..."
]]></lang>
</resource>
<resource id="PKGCLI_HELP_ACTIVATE">
<lang name="zh-CN"><![CDATA[
用法:
pkgcli /active <app_user_model_id> [args]
操作说明:
启动一个 Windows 商店应用。
参数:
<app_user_model_id> App User Model ID (AUMID)。
格式:<包系列名>!<应用ID>
示例Microsoft.WindowsStore_8wekyb3d8bbwe!App
[args] 传递给应用的可选命令行参数。
示例:
pkgcli /active Microsoft.WindowsStore_8wekyb3d8bbwe!App
pkgcli /active MyAppFamily!App --fullscreen --debug
]]></lang>
<lang name="en-US"><![CDATA[
Usage:
pkgcli /active <app_user_model_id> [arguments]
Operation:
Launch a Windows Store app.
Arguments:
<app_user_model_id> The Application User Model ID (AUMID).
Format: <package_family_name>!<app_id>
Example: Microsoft.WindowsStore_8wekyb3d8bbwe!App
[arguments] Optional command-line arguments passed to the app.
Examples:
pkgcli /active Microsoft.WindowsStore_8wekyb3d8bbwe!App
pkgcli /active MyAppFamily!App --fullscreen --debug
]]></lang>
</resource>
<resource id="PKGCLI_HELP_READ">
<lang name="zh-CN"><![CDATA[
用法:
pkgcli /read [选项] [<文件>]
说明:
读取 Appx/MSIX 包(.appx、.appxbundle、.msix、.msixbundle或其清单文件.xml、.appxpackage、.msixpackage
提取包/清单信息,并以 JSON 格式输出到控制台,或保存为包含 info.json 或 info.xml 的 ZIP 压缩包。
选项:
/manifest:<文件> 指定要读取的清单文件。
/package:<文件> 指定要读取的包文件。
<文件> 如果未提供 /manifest 或 /package则使用第一个无名参数作为输入文件。
文件类型根据扩展名自动检测:
.xml、.appxpackage、.msixpackage → 使用清单读取器
.appx、.appxbundle、.msix、.msixbundle → 使用包读取器
/item:<路径> 不输出整个 JSON 对象,仅输出给定路径下的值。
路径语法:使用 '.' 或 ':' 作为分隔符,不区分大小写。
支持索引器(例如 [0])、集合的 .length 以及自动 Base64 访问(例如 LogoBase64
示例:
/item:Identity.Name
/item:Properties.Publisher
/item:applications[0]
/item:applications.length
/item:applications[0].LogoBase64
/usepri 启用 PRI 资源解析(本地化和缩放图片)。要正确解析资源字符串和图片,需要此选项。
/savexml:<输出文件> 将提取的数据保存为 XML 文件,并放入 ZIP 压缩包中。
压缩包中将包含一个 info.xml 文件,内含结构化数据。
/savejson:<输出文件> 将提取的数据保存为 JSON 文件,并放入 ZIP 压缩包中。
压缩包中将包含一个 info.json 文件,内含结构化数据。
/help 显示此帮助文本。
输出行为:
- 如果既未指定 /savexml 也未指定 /savejson则信息直接以 JSON 格式输出到控制台。
- 如果使用了 /item则仅输出指定路径下的值以字符串、版本或格式化 JSON 的形式)。
- 如果使用了 /savexml 或 /savejson则数据将保存到指定的文件ZIP 压缩包),并显示成功/失败信息。
示例:
pkgcli /read MyApp.appx
pkgcli /read /manifest:AppxManifest.xml /usepri
pkgcli /read /package:MyApp.msixbundle /item:Identity.Name
pkgcli /read /package:MyApp.appx /savejson:output.zip
pkgcli /read MyApp.appx /item:applications[0].DisplayName
]]></lang>
<lang name="en-US"><![CDATA[
Usage:
pkgcli /read [options] [<file>]
Description:
Read an Appx/MSIX package (.appx, .appxbundle, .msix, .msixbundle) or its manifest file (.xml, .appxpackage, .msixpackage).
Extracts package/manifest information and outputs as JSON to the console, or saves as a ZIP archive containing either info.json or info.xml.
Options:
/manifest:<file> Specify a manifest file to read.
/package:<file> Specify a package file to read.
<file> If no /manifest or /package is provided, the first unnamed parameter is used as the input file.
File type is auto-detected by extension:
.xml, .appxpackage, .msixpackage → ManifestReader
.appx, .appxbundle, .msix, .msixbundle → PackageReader
/item:<path> Instead of outputting the whole JSON object, output only the value at the given path.
Path syntax: use '.' or ':' as separators, case-insensitive.
Supports indexers (e.g., [0]), .length for collections, and automatic Base64 access (e.g., LogoBase64).
Examples:
/item:Identity.Name
/item:Properties.Publisher
/item:applications[0]
/item:applications.length
/item:applications[0].LogoBase64
/usepri Enable PRI resource resolution (localization and scaled images). Required for proper resource string and image resolution.
/savexml:<output> Save extracted data as an XML file wrapped in a ZIP archive.
The archive will contain an info.xml file with the structured data.
/savejson:<output> Save extracted data as a JSON file wrapped in a ZIP archive.
The archive will contain an info.json file with the structured data.
/help Display this help text.
Output Behavior:
- If neither /savexml nor /savejson is given, the information is printed directly to the console as JSON.
- If /item is used, only the value at the specified path is printed (as a string, version, or formatted JSON).
- If /savexml or /savejson is used, the data is saved to the specified file (ZIP archive) and a success/failure message is shown.
Examples:
pkgcli /read MyApp.appx
pkgcli /read /manifest:AppxManifest.xml /usepri
pkgcli /read /package:MyApp.msixbundle /item:Identity.Name
pkgcli /read /package:MyApp.appx /savejson:output.zip
pkgcli /read MyApp.appx /item:applications[0].DisplayName
]]></lang>
</resource>
<resource id="PKGCLI_HELP_CONFIG">
<lang name="zh-CN"><![CDATA[
用法:
pkgcli /config 显示当前配置(所有键值)。
pkgcli /config /show:<键名> 显示指定配置键的值。
pkgcli /config /set:<键名> <值> 将配置键设置为指定值。
pkgcli /config /refresh 从 config.ini 重新加载配置。
配置键(部分):
AppMetadataItems 从清单中读取的应用元数据字段列表,用逗号分隔。
默认值:"Id,BackgroundColor,DisplayName,ForegroundText,ShortName,SmallLogo,Square44x44Logo"
配置文件:
位于 pkgcli.exe 同目录下的 config.ini。
示例:
pkgcli /config
pkgcli /config /show:AppMetadataItems
pkgcli /config /set:AppMetadataItems "Id,DisplayName,Logo"
pkgcli /config /refresh
]]></lang>
<lang name="en-US"><![CDATA[
Usage:
pkgcli /config Show current configuration (all keys).
pkgcli /config /show:<key> Show value of a specific configuration key.
pkgcli /config /set:<key> <value> Set configuration key to the given value.
pkgcli /config /refresh Reload configuration from config.ini.
Configuration keys (partial):
AppMetadataItems Comma-separated list of application metadata fields to read from manifests.
Default: ""Id,BackgroundColor,DisplayName,ForegroundText,ShortName,SmallLogo,Square44x44Logo""
Configuration file:
config.ini in the same directory as pkgcli.exe.
Examples:
pkgcli /config
pkgcli /config /show:AppMetadataItems
pkgcli /config /set:AppMetadataItems ""Id,DisplayName,Logo""
pkgcli /config /refresh
]]></lang>
</resource>
<resource id="PKGCLI_HELP_VERSION">
<lang name="zh-CN"><![CDATA[
用法:
pkgcli /version
pkgcli /ver
操作说明:
显示 Package Manager CLI 的当前版本。
示例:
pkgcli /version
pkgcli /ver
]]></lang>
<lang name="en-US"><![CDATA[
Usage:
pkgcli /version
pkgcli /ver
Operation:
Display the current version of Package Manager CLI.
Examples:
pkgcli /version
pkgcli /ver
]]></lang>
</resource>
<resource id="PKGCLI_WARNING_ENCODING">
<lang name="zh-CN"><![CDATA[警告:设置输出编码失败。异常:{0}
信息:
{1}
将使用默认编码。]]></lang>
<lang name="en-US"><![CDATA[Warning: Set encoding for output failed. Exception {0}
Message:
{1}
We will use default encoding.]]></lang>
</resource>
<resource id="PKGCLI_PROGRESS_OPERATION">
<lang name="zh-CN">({0}/{1}) 正在执行操作...</lang>
<lang name="en-US">({0}/{1}) Performing operation...</lang>
</resource>
<resource id="PKGCLI_PROGRESS_OPERATION_WITHPROGRESS">
<lang name="zh-CN">({0}/{1}) 正在执行操作... {2}% of {3}%</lang>
<lang name="en-US">({0}/{1}) Performing operation... {2}% of {3}%</lang>
</resource>
<resource id="PKGCLI_COMPLETE_OPERATION">
<lang name="zh-CN">操作已完成。</lang>
<lang name="en-US">All Done.</lang>
</resource>
<resource id="PKGCLI_ERROR_IRUS_EXCEPTION">
<lang name="zh-CN"><![CDATA[包 {0} "{1}" 操作错误 ({2})
{3}]]></lang>
<lang name="en-US"><![CDATA[Package {0} "{1}" Operation Error ({2}):
{3}]]></lang>
</resource>
<resource id="PKGCLI_ASK_REMOVE">
<lang name="zh-CN">我们将要移除 {0} 个应用。确定要继续吗?(Y/N) </lang>
<lang name="en-US">We are about to remove {0} app(-s). Do you want to continue? (Y/N) </lang>
</resource>
<resource id="PKGCLI_ERROR_USERABORT">
<lang name="zh-CN">用户取消操作</lang>
<lang name="en-US">User canceled.</lang>
</resource>
<resource id="PKGCLI_ERROR_EXCEPTION">
<lang name="zh-CN"><![CDATA[操作错误 ({0})
{1}]]></lang>
<lang name="en-US"><![CDATA[Operation Error ({0}):
{1}]]></lang>
</resource>
<resource id="PKGCLI_COMPLETE_DONE">
<lang name="zh-CN">已完成。</lang>
<lang name="en-US">Done.</lang>
</resource>
<resource id="PKGCLI_ERROR_CANNOTFINDKEY">
<lang name="zh-CN">无法找到键 "{0}"。</lang>
<lang name="en-US">Cannot find key "{0}".</lang>
</resource>
<resource id="PKGCLI_ERROR_KEYSTRINGEMPTY">
<lang name="zh-CN">键为空值。</lang>
<lang name="en-US">Key is empty.</lang>
</resource>
<resource id="PKGCLI_ERROR_FINALEXCEPTION">
<lang name="zh-CN"><![CDATA[异常 {0}:
信息:
{1}
堆栈轨迹:
{2}]]></lang>
<lang name="en-US"><![CDATA[Exception {0}:
Message:
{1}
Stack:
{2}]]></lang>
</resource>
</resources>