How to use Powershelll imports Microsoft Wubi user-defined thesaurus

尔文 凤 0 Reputation points
2023-05-21T00:11:31.6233333+00:00

Hello!

I want to use powershell V7.0 to import Microsoft's own Wubi input method user dictionary

The suggested code given by ChartGPT is as follows:

Define user-defined phrase file path

$phraseFile = "F:\003_PCPro\001_Wubi Thesaurus.dat"

Define the registry key path

$registryPath = "HKCU\Software\Microsoft\InputMethod\Settings\CHS\Wubi"

Import user-defined phrase files

$bytes = [System.IO.File]::ReadAllBytes($phraseFile)

$base64String = [System.Convert]::ToBase64String($bytes)

Update the value of the registry key

$registryKey = [Microsoft.Win32.Registry]::CurrentUser.OpenSubKey($registryPath, $true)

$registryKey.SetValue("UserPhrases", $base64String, [Microsoft.Win32.RegistryValueKind]::Binary)

$registryKey. Close()

But there is no Wubi field in the registry, and powershell prompts You cannot call a method on a null-valued expression.

In doubt, which registry field should be used

PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,575 questions
{count} votes

1 answer

Sort by: Most helpful
  1. 尔文 凤 0 Reputation points
    2023-05-23T02:29:23.1733333+00:00

    Let me talk about the scene:

    I often need to add professional terms to Wubi's custom thesaurus. And I have multiple computers that need to synchronize this custom dictionary.

    So I often use the following windows.

    So I want to script my actions using Powershell.

    The requirements are as follows:

    1. Can automatically open the new interface
    2. Can automatically import Wubi thesaurus

    I first mentioned my second requirement to GPT, and GPT's reply was tested and could not meet my needs.

    So I want to ask in the forum if it can be achieved through Powershell

    User's image

    User's image

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.