3

Windows Sandbox (24H2 version) has no Notepad included. How can I install it?

Giacomo1968
  • 58,727

3 Answers3

1

According to this page - Windows Sandbox from Microsoft, you need to:

Usage

  1. Copy an executable file (and any other files needed to run the application) from the host and paste them into the Windows Sandbox window.
  2. Run the executable file or installer inside the sandbox.
  3. When you're finished experimenting, close the sandbox. A dialog box will state that all sandbox content will be discarded and permanently deleted. Select Ok.
  4. Confirm that your host machine doesn't exhibit any of the modifications that you made in Windows Sandbox.

Follow steps 1 and 2.

You can find notepad.exe in the following folders:

  • C:\Windows
  • C:\Windows\SysWOW64
  • C:\Windows\System32
  • C:\Program Files\WindowsApps\Microsoft.WindowsNotepad_11.2405.13.0_x64__8wekyb3d8bbwe\Notepad
1

There isn't a Microsoft supported way of doing this, but it is possible. It's not easy, so seriously consider doing a silent install of Notepad++ or whatever text editor you prefer instead.

Notepad is now distributed as a packaged app through the Microsoft Store, which is not available in Windows Sandbox. You can install the package manually, but it won't run without a license. An older version without tabs is available as optional Windows feature, but optional features are also not available in the sandbox. Fortunately you can copy the files over without much trouble.

Classic Notepad

The old Notepad will work if you just copy over the right files, but for a full install you would also need to add it to the start menu and set up file associations. I'm not going to cover that. One thing you can't easily do is add an "Open with Notepad" item to the new context menu (registry keys don't do it anymore; you need package identity and an IExplorerCommand implementation).

You probably already have the old Notepad installed on your host, but if it does not have a notepad.exe in its C:\Windows\ directory, go to Settings > System > Optional features and add the Notepad (system) feature.

"Notepad (system)" feature in Settings > System > Optional features

Copy the following files into the same location in the sandbox, substituting your language code for en-US:

  • C:\Windows\notepad.exe
  • C:\Windows\System32\notepad.exe
  • C:\Windows\SysWOW64\notepad.exe
  • C:\Windows\en-US\notepad.exe.mui
  • C:\Windows\System32\en-US\notepad.exe.mui

The first two are the same—hard links actually. Notepad was in one place in Windows 95 and the other in Windows NT. The third is the 32-bit version.

Note that you will get redirected to the new Notepad if you run any of those from their normal location on a system that has new Notepad installed. That won't happen in the sandbox. Also, if you put them somewhere other than their normal locations, they will silently fail to start if the MUI file is not present at the correct relative location.

New Notepad

First you'll need to get a license for Notepad. The one on your machine is machine specific, but there is a generic offline license on the Windows installation media. Use 7-Zip to navigate to <FlashDrive>:\sources\install.esd\1\ProgramData\Microsoft\Windows\ClipSVC\Install\Apps\ and copy out the microsoft.windowsnotepad_8wekyb3d8bbwe.xml file.

To manually download the Notepad package and its dependencies, put the Microsoft Store link for Notepad into the store.rg-adguard.net link generator. You are generally going to want, for each package in the list, the appx/msixbundle file with the highest version number and your architecture. (To be sure, you could look at the dependencies listed in AppxManifest.xml within the package for your architecture within the latest Notepad bundle, but the latest version of everything is probably fine.)

Finally, use the Add-AppxProvisionedPackage PowerShell command within the sandbox to do the install. You will almost certainly have to make some changes to the sample below to match the files you have.

$pkg = ".\Microsoft.WindowsNotepad_11.2504.62.0_neutral_~_8wekyb3d8bbwe.Msixbundle"
$dep = @(
".\Microsoft.UI.Xaml.2.8_8.2501.31001.0_x64__8wekyb3d8bbwe.Appx",
".\Microsoft.VCLibs.140.00.UWPDesktop_14.0.33728.0_x64__8wekyb3d8bbwe.Appx",
".\Microsoft.VCLibs.140.00_14.0.33519.0_x64__8wekyb3d8bbwe.Appx")
$lic = ".\microsoft.windowsnotepad_8wekyb3d8bbwe.xml"
Add-AppxProvisionedPackage -Online -PackagePath $pkg -DependencyPackagePath $dep -LicensePath $lic
Billy
  • 180
0

For a complete install with the context menu and associated .txt filetype do as follows:

create a folder in the root of C: called "Win-Sandbox", Copy notepad.exe from the system32 folder to that folder. Open a textfile and paste what is below and save as "Register_Notepad.reg", and save to the same folder.

Windows Registry Editor Version 5.00

[-HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Applications\notepad.exe]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Applications\notepad.exe]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Applications\notepad.exe\shell]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Applications\notepad.exe\shell\edit]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Applications\notepad.exe\shell\edit\command] @=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,
00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,4e,00,4f,00,
54,00,45,00,50,00,41,00,44,00,2e,00,45,00,58,00,45,00,20,00,25,00,31,00,00,
00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Applications\notepad.exe\shell\open]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Applications\notepad.exe\shell\open\command] @=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,
00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,4e,00,4f,00,
54,00,45,00,50,00,41,00,44,00,2e,00,45,00,58,00,45,00,20,00,25,00,31,00,00,
00

[-HKEY_LOCAL_MACHINE\SOFTWARE\Classes.txt]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes.txt] @="txtfile" "Content Type"="text/plain" "PerceivedType"="text"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes.txt\PersistentHandler] @="{5e941d80-bf96-11cd-b579-08002b30bfeb}"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes.txt\ShellNew] "ItemName"=hex(2):40,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,
6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,
00,6e,00,6f,00,74,00,65,00,70,00,61,00,64,00,2e,00,65,00,78,00,65,00,2c,00,
2d,00,34,00,37,00,30,00,00,00 "NullFile"=""

[-HKEY_LOCAL_MACHINE\SOFTWARE\Classes\SystemFileAssociations.txt]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\SystemFileAssociations.txt] "PerceivedType"="document"

[-HKEY_LOCAL_MACHINE\SOFTWARE\Classes\txtfile]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\txtfile] @="Text Document" "EditFlags"=dword:00210000 "FriendlyTypeName"=hex(2):40,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,
00,6f,00,6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,
32,00,5c,00,6e,00,6f,00,74,00,65,00,70,00,61,00,64,00,2e,00,65,00,78,00,65,
00,2c,00,2d,00,34,00,36,00,39,00,00,00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\txtfile\DefaultIcon] @=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,
00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,69,00,6d,00,
61,00,67,00,65,00,72,00,65,00,73,00,2e,00,64,00,6c,00,6c,00,2c,00,2d,00,31,
00,30,00,32,00,00,00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\txtfile\shell\open\command] @=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,
00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,4e,00,4f,00,
54,00,45,00,50,00,41,00,44,00,2e,00,45,00,58,00,45,00,20,00,25,00,31,00,00,
00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\txtfile\shell\print\command] @=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,
00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,4e,00,4f,00,
54,00,45,00,50,00,41,00,44,00,2e,00,45,00,58,00,45,00,20,00,2f,00,70,00,20,
00,25,00,31,00,00,00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\txtfile\shell\printto\command] @=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,
00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,6e,00,6f,00,
74,00,65,00,70,00,61,00,64,00,2e,00,65,00,78,00,65,00,20,00,2f,00,70,00,74,
00,20,00,22,00,25,00,31,00,22,00,20,00,22,00,25,00,32,00,22,00,20,00,22,00,
25,00,33,00,22,00,20,00,22,00,25,00,34,00,22,00,00,00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts] "txtfile_.txt"=dword:00000000

[-HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts.txt]

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts.txt\OpenWithList]

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts.txt\OpenWithProgids] "txtfile"=hex(0):

[-HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\Roaming\OpenWith\FileExts.txt]

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\Roaming\OpenWith\FileExts.txt\UserChoice] "Hash"="FvJcqeZpmOE=" "ProgId"="txtfile"

Copy the notepad shortcutfile also to that same folder, (Notepad.lnk) from here:

%PROGRAMDATA%\Microsoft\Windows\Start Menu\Programs

Create a Installer.bat with the below and put in the Win-Sandbox folder :

@echo off

pushd "%~dp0"

REM Silently install Notepad copy "notepad.exe" "%SYSTEMROOT%\System32\notepad.exe" regedit.exe /s "Register_Notepad.reg" copy "Notepad.lnk" "%userprofile%\desktop\Notepad.lnk" copy "Notepad.lnk" "%PROGRAMDATA%\Microsoft\Windows\Start Menu\Programs\Notepad.lnk" REM Restart File Explorer to apply changes Powershell.exe Stop-Process -Name explorer -Force

Now create a configuration file for windows sandbox, (WinSandbox.wsb) Like below and execute the sandbox from that file, Done.

<Configuration>
<VideoInput>Disable</VideoInput>
<AudioInput>Disable</AudioInput>
  <MappedFolders>
    <MappedFolder>
      <HostFolder>C:\Win-Sandbox</HostFolder>
      <SandboxFolder>C:\Win-Sandbox</SandboxFolder>
      <ReadOnly>true</ReadOnly>
    </MappedFolder>
  </MappedFolders>
  <LogonCommand>
    <Command>C:\Win-Sandbox\Installer.bat</Command>
  </LogonCommand>
</Configuration>

There are many file associations missing in the sandbox, (log, ini, inf etc) if you want to add them you can get them here at tenforums.com Restore Default Apps for File Type Association

Dobbelina
  • 111