Question

How do I automatically launch a non-Surface application in Windows Embedded 8?

I want to automatically launch a GUI application on startup in Windows Embedded 8, but I can't figure out how to do it. I've been reading Sean Liming's Professional's Guide to Windows Embedded 8 Standard, and in chapter 8 he describes how to modify the device experience. He names how there is a Windows 8 Application launcher, but for Surface apps only. He also describes a Shell Launcher module, but my app is not a shell. He also mentions a shell he wrote here, but reading through its documentation, it doesn't describe how to automatically launch a program within that shell.

As far as I can tell, he doesn't describe how to automatically launch a non-Surface application anywhere, and Google and Stack Exchange get me no results (it doesn't help that most results come back as merely Windows 8, and not Windows Embedded 8). Or am I mistaken? Is Shell Launcher sufficient to launch a non-shell app? Does the app launched become the "shell", in effect?

Side note: It's probably worth mentioning that the app I want to launch is a Java app. I will be including the module-based Java JRE installer as mentioned in the book, but if there are any other provisos to launching a Java app in WE8S, please comment.

Thanks for your time and feedback!

Was it helpful?

Solution

This works for both Windows Embedded Standard 7 and Windows Embedded 8 Standard:

I normally install Windows Embedded Standard with the standard shell. In WE8S this would be the Metro UI. Once installation and configuration is complete, and your application runs successfully, I use registry entries to modify the application launched on startup.

Custom user-specific shell

As an example, to launch VLC media player as the shell, and play media files in a folder on the d:\ e.g d:\media in a continuous loop, I use the below in a .bat file, running as administrator.

This must be run while logged into the user that will launch the custom shell

  • Create a new .bat file:

    1. in Windows Explorer, Select "File" -> "New" -> "Text Document"
    2. Rename "New Text Document.txt" to custom_shell.bat
  • Paste the below into the file

  • Save the file
  • Right click the file -> "Run as Administrator"

    c:\Windows\system32\reg.exe DELETE "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Shell /f
    c:\Windows\system32\reg.exe ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Shell /t REG_SZ /d explorer.exe
    c:\Windows\system32\reg.exe ADD "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Shell /t REG_SZ /d "c:\program files\vlc\vlc.exe -f --loop ""d:\media"""
    c:\Windows\system32\reg.exe DELETE "HKLM\Software\Microsoft\Windows NT\CurrentVersion\IniFileMapping\system.ini\boot" /v Shell /f
    c:\Windows\system32\reg.exe ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\IniFileMapping\system.ini\boot" /v Shell /t REG_SZ /d "USR:Software\Microsoft\Windows NT\CurrentVersion\Winlogon"
    pause
    

This modifies the shell for the !Current User! (i.e. the logged on user) to launch VLC.exe on logon. (I use reg.exe because some slimmed down installations might not have regedit.exe included)

This means that you can still access the full user interface when logging on as the administrator user (via safe mode if Administrator profile is normally disabled), since the shell for all other users is still the explorer shell.

Launching the explorer shell from within the custom shell

You can still launch the explorer shell with the metro UI when the user with the custom shell is logged on. To launch the explorer shell from the user running the VLC (custom) shell:

  • Start the task manager (CTRL+SHIFT+ESC)
  • Click on the "Advanced" button at the bottom of the task manager
  • Select "File" -> "New Task (Run...)" from the menu bar
  • Enter "Explorer.exe" (This start the explorer service)
  • Repeat the above steps again (This will lauch an instance of Windows Explorer)
  • The Metro UI should be usable then

Java application as a shell

More to the point, in order to run your java app, change the below entry in the above .bat

from:

c:\Windows\system32\reg.exe ADD "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Shell /t REG_SZ /d "c:\program files\vlc\vlc.exe -f --loop ""d:\media"""

to

c:\Windows\system32\reg.exe ADD "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Shell /t REG_SZ /d "java [any other JVM options you need to give it] -jar "path\jar-file-name.jar""

If your java app does not include a manifest the above will not work!

Try this (I have not tested this):

java -cp jar-file-name.jar full.package.name.ClassName

Revert to the Explorer (default shell) i.e. Undo user-specific shell

To undo the shell changes for the user i.e. revert back to original settings:

!This must be run while logged into the user with the custom shell!

  • Create a new .bat file:

    1. in Windows Explorer, Select "File" -> "New" -> "Text Document"
    2. Rename "New Text Document.txt" to default_shell.bat
  • Paste the below into the file

  • Save the file
  • Right click the file -> "Run as Administrator"

    c:\Windows\system32\reg.exe DELETE "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Shell /f
    c:\Windows\system32\reg.exe ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Shell /t REG_SZ /d explorer.exe
    c:\Windows\system32\reg.exe DELETE "HKLM\Software\Microsoft\Windows NT\CurrentVersion\IniFileMapping\system.ini\boot" /v Shell /f
    c:\Windows\system32\reg.exe ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\IniFileMapping\system.ini\boot" /v Shell /t REG_SZ /d "SYS:Microsoft\Windows NT\CurrentVersion\Winlogon"
    c:\Windows\system32\reg.exe DELETE "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Shell /f
    pause
    

User Auto Logon:

You can configure Windows to automatically log onto a specific user profile.

  • Start > Search > netplwiz
  • OR [Windows Key + R] > netplwiz
  • A ‘User Account’ window will open. Highlight the account you want to automatically load when Windows starts.
  • Uncheck the box above it titled “Users must enter a user name and password to use this computer.”
  • Click OK.
  • You will be prompted to confirm the operation by entering your password.
  • Enter your password to complete the change.

The next time you start up Windows, the user account you selected will automatically be loaded

Things to consider

Play around, but use a test environment if possible If you can launch the shell, so can someone else. Use the keyboard filter to filter out known key combinations, and create one only you, and perhaps the service technicians will know. Remove admin rights for the user with the custom shell Use the Unified Write Filter (or Enhanced Wright Filter/File Based Write Filter). Un-protect only when making changes.

A big THANK YOU to Sean Liming and the work that does - he inspired this.

Mark Böhmer Windows Embedded Specialist South Africa

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top