Add "Run in Sandbox" options on Windows 10

Martin Brinkmann
Aug 9, 2020
Windows, Windows 10
|
22

Run in Sandbox is a useful PowerShell script that Windows 10 administrators may use to add options to run executable files, zip archives, and scripts, in the Windows 10 sandbox.

Microsoft introduced Windows Sandbox in late 2018 as a way for administrators to run content in its own environment to avoid harm or changes to the underlying system. The Windows Sandbox is available in all professional versions of Windows 10 version 1903 or newer, but Windows 10 Home administrators may add it to Home systems as well; check out this guide that explains how to do that.

Run in Sandbox adds shortcuts for various file types to File Explorer on Windows 10. Once installed, all it takes to run a supported file type in the sandbox is to right-click on it and select the "run in sandbox" option from the context menu.

The main requirement for the script is that Windows Sandbox is installed already on the system. You can add the sandbox by searching for "turn Windows features on or off" and checking the "Windows Sandbox" entry in the Control Panel applet that opens. It is likely that this is going to be moved to the Settings app in the future, but for now, it works.

run in sandbox install

To install Run in Sandbox, do the following:

  1. Download the latest version from the developer's GitHub project site, e.g. select Code > Download Zip.
  2. Extract the archive on your system and open a File Explorer instance to navigate to the folder.
  3. Select File > Open Windows PowerShell > Open Windows PowerShell as Administrator.
  4. Run the following commands in the PowerShell prompt and select Y whenever you are prompted.
    1. Set-ExecutionPolicy Unrestricted
    2. .\Add_Structure.ps1
    3. Set-ExecutionPolicy AllSigned

The script adds the context menu entries to File Explorer.

Note: When I tested the script on an English Windows 10 Pro version 2004 system, I noticed that it added French menu entries instead of English ones; this is probably a bug but easy enough to understand.

run in sandbox

Run in Sandbox supports PS1, VBS, MSI, and EXE file types at the time of writing. The script creates a WSB file when you select the Run in Sandbox option from the context menu and the sandbox will be launched automatically afterwards.

Scripts, PS1 and VBS, display two context menu entries instead of one. The first runs the script without any parameters, the second allows you to add parameters.

Closing Words

Run in Sandbox is a useful tool for system administrators, software testers, and other users who like to execute content in a safe environment. While that is also supported by third-party applications like Sandboxie, it is not always allowed to run these in work environments. The Windows Sandbox offers a way out.

Now You: do you use a sandbox application? (via Deskmodder)

Summary
Add "Run in Sandbox" options on Windows 10
Article Name
Add "Run in Sandbox" options on Windows 10
Description
Find out how to make better use of the Windows Sandbox by adding File Explorer "run in sandbox" entries to the Windows 10 system.
Author
Publisher
Ghacks Technology News
Logo
Advertisement

Tutorials & Tips


Previous Post: «
Next Post: «

Comments

  1. mohib said on March 14, 2022 at 2:16 am
    Reply

    Hi. i want to run sandbox by PowerShell and give a file path to execute it . Would you please help me in finding this.

    Furthermore I’m in search if the file during execution takes network permission than decline to run

  2. Al Winston said on May 28, 2021 at 6:39 am
    Reply

    Uh, the \Add_Structure.ps1 is missing. Sooooooo this is worthless.

  3. Krystina said on August 12, 2020 at 11:08 pm
    Reply

    This is exactly what happened to me. Luckily I had another Windows system where I were able to export the keys in HKLM\SOFTWARE\Classes\ to import them on my broken system.

    I then spent about 30 minutes cleaning my registry.

    Avoid this software it if you do not want to mess up your system.

  4. Kevin said on August 12, 2020 at 5:12 pm
    Reply

    BE EXTREMELY CAREFUL WITH THIS. If this script encounters an error this can lead to your system not being able to launch EXE, MSI, VBS or PS1 files AT ALL. It will take a system restore in order to get these registry values back correctly as you will not be able to run the Registry Editor, Command Prompt or even Task Manager.

  5. Anonymous said on August 11, 2020 at 2:39 pm
    Reply

    To remove if you had installed en francais….

    Reg.exe delete “HKLM\SOFTWARE\Classes\Microsoft.PowerShellScript.1\Shell\Exécuter le PS1 dans Sandbox” /f
    Reg.exe delete “HKLM\SOFTWARE\Classes\Microsoft.PowerShellScript.1\Shell\Exécuter le PS1 dans Sandbox avec des paramètres” /f
    Reg.exe delete “HKLM\SOFTWARE\Classes\VBSFile\Shell\Exécuter le VBS dans Sandbox” /f
    Reg.exe delete “HKLM\SOFTWARE\Classes\VBSFile\Shell\Exécuter le VBS dans Sandbox avec des paramètres” /f
    Reg.exe delete “HKLM\SOFTWARE\Classes\exefile\shell\Exécuter l’EXE dans Sandbox” /f
    Reg.exe delete “HKLM\SOFTWARE\Classes\Msi.Package\shell\Exécuter le MSI dans Sandbox”

  6. Anonymous said on August 10, 2020 at 7:43 pm
    Reply

    Reg.exe delete “HKLM\SOFTWARE\Classes\Microsoft.PowerShellScript.1\Shell\Run the PS1 in Sandbox” /f
    Reg.exe delete “HKLM\SOFTWARE\Classes\Microsoft.PowerShellScript.1\Shell\Run the PS1 in Sandbox with parameters” /f
    Reg.exe delete “HKLM\SOFTWARE\Classes\VBSFile\Shell\Run the VBS in Sandbox” /f
    Reg.exe delete “HKLM\SOFTWARE\Classes\VBSFile\Shell\Run the VBS in Sandbox with parameters” /f
    Reg.exe delete “HKLM\SOFTWARE\Classes\exefile\shell\Run the EXE in Sandbox” /f
    Reg.exe delete “HKLM\SOFTWARE\Classes\Msi.Package\shell\Run the MSI in Sandbox”

    Delete these keys to remove

  7. CC said on August 10, 2020 at 7:37 pm
    Reply

    I configured the xml to get this to be english but now I have both english and french. How can I uninstall the french option from my context menu?

  8. Anonymous said on August 10, 2020 at 7:26 pm
    Reply

    I was able to change the language by modifying the xml and readding through this process. Now I have the french and the english version. How can I remove the french?

  9. Anonymous said on August 10, 2020 at 7:02 pm
    Reply

    How do we remove this?

  10. Simon F. said on August 10, 2020 at 5:29 pm
    Reply

    Hi Martin,
    Nice tool.
    One small thing with the article, Snapshots are showing German text, not French. :)

    1. Martin Brinkmann said on August 10, 2020 at 6:37 pm
      Reply

      You are welcome. The second screenshot shows the French entry “extraire le zip dans sandbox” that the PowerShell script added.

  11. klaus said on August 10, 2020 at 9:16 am
    Reply

    how to solve the langeu problem: (from github)

    Update (05/19/20): Add other languages for context menus

    Those languages are available: French, Italian, Spanish, English, German
    To configure language, go to Sources\Run_in_Sandbox\Sandbox_Config.xml
    Add language in Main_Language
    This language should be the language code name

  12. Arun said on August 10, 2020 at 6:03 am
    Reply

    Hi Martin, Do you know how to uninstall this if no longer want it?

  13. Victor said on August 10, 2020 at 12:22 am
    Reply

    Please correct your article’s title to specify Windows 10 Professional. All the later comments at the link you supplied to the sandbox running on Windows 10 Home say the sandbox does not run on Windows 10 Home.

  14. Anonymous said on August 10, 2020 at 12:14 am
    Reply

    has anyone used it? is it better than the sandboxie?

  15. Armando said on August 9, 2020 at 8:31 pm
    Reply

    Hi. This might be of help:
    When I ran .\Add_Structure.ps1, my system crashed and a BSOD was displayed with an error message about something watchdog something. Sorry I didn’t take note of it. But the watchdog part made me think it had something to do with windows’ integrated antivirus/antimalware. So I disabled it and sure enough, the script ran without any trouble. After it runs, one can safely re-enable the realtime protection.

  16. no said on August 9, 2020 at 8:14 pm
    Reply

    That context menu is disgusting…

    1. no lemons said on August 10, 2020 at 10:43 pm
      Reply

      It’s actually pretty sexy.

    2. Anonymous said on August 10, 2020 at 8:42 am
      Reply

      I am sure it is a testing machine :)

  17. ipnonymous said on August 9, 2020 at 5:58 pm
    Reply

    Hopefully there comes a menu option to automate this for things like web browsers.

    Once a program is run sandboxed will it continue to be sandboxed after reboots or is it necessary to sandbox the desired application upon each use?

    1. Barton said on August 9, 2020 at 7:31 pm
      Reply

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.