I have a nodeJS script that processes an Inkscape SVG file and exports certain layers using the following command:
inkscape.exe "myfile.svg" -i ${id} -j -C --export-png="${outPath}"
However, on my new system, I installed Inkscape from the Windows Store, and now the executable is located in the C:\ProgramFiles\WindowsApps
folder, which is not accessible. While I could change the permissions to access the folder, I believe it is locked for a good reason.
Is there a way to run a Windows app without accessing the WindowsApps
folder? I am looking for a solution that works for most apps, not just Inkscape.
3 Answers
Introduction
Windows Store is a popular platform for downloading and installing applications on Windows 10. When you download an app from the Windows Store, it is installed in a protected folder called the WindowsApps
folder. This folder is inaccessible to most users for security reasons. However, this can cause problems when you need to run an app from another application, like a script or a batch file. In this blog post, we will discuss how to start a Windows app from another application without affecting the WindowsApps
folder settings.
Using PowerShell
PowerShell is a powerful tool that can help you start a Windows app from another application without accessing the WindowsApps
folder. Here is how to do it:
1. Open PowerShell by typing “PowerShell” in the Start menu search bar.
2. Type the following command: Start-Process -FilePath "ms-windows-store://" -ArgumentList "pfn:<package family name>".
Replace <package family name> with the package family name of the app you want to start. You can find the package family name by following these steps:
a. Open the Start menu and find the app you want to start.
b. Right-click on the app and select “More” > “App Settings.”
c. Scroll down to “Advanced options” and look for the “Package family name” field.
d. Copy the package family name and paste it into the PowerShell command.
3. Press Enter to run the command.
This will start the app without accessing the WindowsApps
folder. You can use this method to start most Windows Store apps.
Using a Shortcut
Another way to start a Windows app without accessing the WindowsApps
folder is to create a shortcut to the app and use it to start the app from another application. Here is how to do it:
1. Open the Start menu and find the app you want to start.
2. Right-click on the app and select “More” > “Open file location.” This will open the folder where the app is installed.
3. Right-click on the app and select “Create shortcut.” This will create a shortcut to the app.
4. Move the shortcut to a folder that is accessible from your script or batch file.
5. Use the shortcut to start the app from your script or batch file. You can do this by typing the path to the shortcut in your script or batch file and adding “.lnk” to the end of the path.
This method works for most Windows Store apps, but some apps may not allow you to create a shortcut.
Using a Third-Party Tool
There are several third-party tools available that can help you start a Windows app without accessing the WindowsApps
folder. One such tool is the MSIX Packaging Tool from Microsoft. Here is how to use it:
1. Download and install the MSIX Packaging Tool.
2. Open the tool and click on “Package editor” in the left-hand menu.
3. Click on “Open package” and select the app you want to start.
4. Click on “Modify” and select “Add executable.”
5. Enter the path to the executable you want to use to start the app. This can be a script or a batch file.
6. Click on “Save package” to save the changes.
7. Use the modified package to start the app from your script or batch file.
This method is more complex than the previous methods, but it gives you more control over how the app is started.
Using the Registry
The Windows Registry is a database that stores configuration settings for Windows and its applications. You can use the Registry to start a Windows app without accessing the WindowsApps
folder. Here is how to do it:
1. Open the Registry Editor by typing “regedit” in the Start menu search bar.
2. Navigate to the following key: HKEY_CLASSES_ROOTExtensionsContractIdWindows.ProtocolPackageId
. Replace “ContractId” with the contract ID of the app you want to start. You can find the contract ID by following these steps:
a. Open the Start menu and find the app you want to start.
b. Right-click on the app and select “More” > “App Settings.”
c. Scroll down to “Advanced options” and look for the “Contract ID” field.
d. Copy the contract ID and paste it into the Registry key.
3. Right-click on the “PackageId” key and select “New” > “String Value.”
4. Name the new string value “ApplicationPath” and set its value to the path of the executable you want to use to start the app. This can be a script or a batch file.
5. Close the Registry Editor.
6. Use the Windows protocol to start the app from your script or batch file by typing the following command: start ms-windows-store://pdp/?PFN=<package family name>
. Replace <package family name> with the package family name of the app you want to start.
This method requires some knowledge of the Windows Registry, but it is a powerful way to start a Windows app without accessing the WindowsApps
folder.
Conclusion
Starting a Windows app from another application without accessing the WindowsApps
folder can be challenging, but there are several ways to do it. You can use PowerShell, a shortcut, a third-party tool, or the Registry to start a Windows app from your script or batch file. Each method has its advantages and disadvantages, so choose the one that works best for your situation. With these methods, you can run your Windows Store apps from any application without compromising the security of the WindowsApps
folder.
You should be able to start a Windows app from another application without affecting the WindowsApps folder settings by using the following steps:
- Find the package family name of the app you want to start. You can do this by opening the Start menu, right-clicking on the app, and selecting “More > App settings”. The package family name will be listed under the “App info” section.
- Use the start command to launch the app. The general syntax for starting an app is:
start /b "" "shell:Appsfolder\PackageFamilyName!App"
Where PackageFamilyName
is the package family name you found in step 1, and App
is the name of the app you want to start (e.g. Microsoft.WindowsCalculator_8wekyb3d8bbwe!App
).
For example, to start Inkscape using this method, you would use the following command:
start /b "" "shell:Appsfolder\inkscape.Inkscape_8wekyb3d8bbwe!App"
Note that this method will only work if the app is installed from the Microsoft Store. If the app is not installed from the store, you will need to use a different method to launch it.
As a final thought, keep in mind that the WindowsApps folder is protected for a reason, as it contains system files and important applications that are essential for the functioning of your system. Modifying the permissions of this folder or attempting to access its contents can cause serious problems with your system, so it is generally not recommended.
Instead, you should try to use methods like the one described above to launch apps that are installed in the WindowsApps folder, or consider installing apps outside of this folder if you need to access them from other applications. This will help to protect your system and ensure that it continues to function properly.
To find a way to run a UWP app without accessing the C:\ProgramFiles\WindowsApps folder, you can try the following steps:
- Open a PowerShell window and run the command
get-appxpackage > Result.txt
. This will create a text file calledResult.txt
in the current user’s profile directory. - Open
Result.txt
and look for theInstallLocation
andPackageFamilyName
for the app you want to run. In this example, we will use Windows Calculator. - Use File Explorer to navigate to the
InstallLocation
directory and openAppManifest.xml
with Notepad. - Search for the executable of the UWP app you are trying to start and find its
Application ID
. In this case, we are looking for theApplication ID
of Windows Calculator. Note that in some cases, there may be multiple UWP packages in the same folder, andAppManifest.xml
will handle multiple executables. - In a command prompt, type
explorer.exe shell:appsFolder\[Application ID]
to start the app. For example, to start Windows Calculator, we would typeexplorer.exe shell:appsFolder\Microsoft.WindowsCalculator_8wekyb3d8bbwe!App
. - If you found the correct
Application ID
, the app should start. Keep in mind that the install location for UWP apps is not static and may change with new versions.
As an example, to start Windows Live Calendar, we can run explorer.exe shell:appsFolder\microsoft.windowscommunicationsapps_8wekyb3d8bbwe!microsoft.windowslive.calendar
.
It’s worth noting that changing the permissions on the WindowsApps
folder is not recommended, as it can cause UWP apps to stop functioning properly.
Remember that the install location for UWP apps is not static and may change with new versions. As a result, it’s a good idea to follow these steps each time you want to run a UWP app from the command prompt.
I hope this helps! Let me know if you have any questions or need further clarification.