Steps to Run the Batch Script in Kiosk Mode
1. Prepare the Batch Script
Ensure your batch script (
start_server.bat
) is located in a secure and accessible location, such asC:\MayaWINX\
.Test the script to confirm it runs correctly in the background without requiring user interaction.
2. Run the Script as a Scheduled Task
Since the kiosk mode restricts access to the startup folder for the kiosk user, you can use Task Scheduler to run the script at system startup.
Steps:
Open Task Scheduler (
taskschd.msc
).Click Create Task in the right-hand pane.
In the General tab:
Name the task (e.g.,
StartServerScript
).Select Run whether user is logged on or not.
Check Do not store password (if applicable).
Check Run with highest privileges.
In the Triggers tab:
Click New.
Set the trigger to At startup.
In the Actions tab:
Click New.
Set Action to
Start a program
.Browse to your batch script (
C:\MayaWINX\start_server.bat
).
In the Conditions tab:
Uncheck any conditions that might prevent the script from running (e.g., "Start the task only if the computer is on AC power").
In the Settings tab:
Ensure Allow task to be run on demand is checked.
Uncheck Stop the task if it runs longer than (unless you want to set a time limit).
Click OK to save the task.
3. Test the Setup
Restart the computer to confirm the batch script runs automatically at startup.
Verify that the kiosk app (browser) launches correctly and the script runs in the background.
...
Step 1: Convert Batch File to Service Using sc
Command
You can use the sc
command to create a service that executes your batch script.
Create a Windows Service using
sc
: Open Command Prompt (as Administrator) and run the following:sc create MayaWINXService binPath= "C:\Windows\System32\cmd.exe /c C:\MayaWINX\start_server.bat" start= auto
Explanation:
MayaWINXService
: The name of your service.binPath
: Command to run your batch script.start= auto
: Starts the service automatically at boot.
Start the Service:
sc start MayaWINXService
Check Service Status:
sc query MayaWINXService
...
Step 2: Optional — Use nssm
for Better Control
If the batch script needs to run continuously
...
(e.g., a server process), use nssm (Non-Sucking Service Manager), which is more reliable than sc
for running non-Windows executables.
Steps:
...
Download
nssm
from https://nssm.cc/download.
...
Open Command Prompt as Administrator.
Install your batch file as a service:
...
...
nssm
...
install
...
MayaWINXService
In the
...
GUI that appears:
...
- Path:
C:\Windows\System32\cmd.exe
- Startup Directory:
C:\MayaWINX\
- Arguments:
/c start_server.bat
- Path:
...
Configure the Startup directory (if needed).
...
...
Click Install service.
Start the service:
...
net start StartServerService
Important Notes
Permissions: Ensure the batch script and any files it accesses have the correct permissions to run under the system or kiosk account.
Security: Kiosk mode is designed to restrict access, so ensure your script does not introduce vulnerabilities.
Testing: Thoroughly test the setup to ensure the script runs as expected without interfering with the kiosk app.
...
nssm start MayaWINXService
...
Advantages of Running as a Service:
- Runs before login, even in Kiosk Mode.
- No UI pop-ups or user interaction required.
- Automatically restarts if it crashes (with
nssm
). - Can be monitored and controlled using
services.msc
.