Here are the contents of my file:
> usermessage.vbs ECHO Set wshShell = CreateObject( “WScript.Shell” )
>>usermessage.vbs ECHO wshShell.Popup “My Text line 1” ^& vbCrLf ^& _
>>usermessage.vbs ECHO “My Text line 2” ^& vbCrLf ^& _
>>usermessage.vbs ECHO “My Text line 3” ^& vbCrLf ^& _
>>usermessage.vbs ECHO “My Text line 4” ^& vbCrLf ^& _
>>usermessage.vbs ECHO “My Text line 5” ^& vbCrLf ^& _
>>usermessage.vbs ECHO “My Text line 6” ^& vbCrLf ^& _
>>usermessage.vbs ECHO “My Text line 7” ^& vbCrLf ^& _
>>usermessage.vbs ECHO “My Text line 8” ^& vbCrLf ^& _
>>usermessage.vbs ECHO “My Text line 9”, 120, _
>>usermessage.vbs ECHO “My Window Title”, 64
I searched the internet for hours using various terms and finally found a suggestion that your software would solve my problem.
It runs perfectly if I just click on it. But I could not make it run as a service. I’m not a pro at this.
Hi John. Thanks for trying AlwaysUp and for getting in touch.
What’s the batch file doing?
We’re not VBScript experts so it took us a while to understand what your batch file is doing!
However, it soon became clear that the batch file:
Constructs a VBScript file named usermessage.vbs on the fly.
Adds a line to usermessage.vbs to create a Windows Script shell object.
Adds lines to usermessage.vbs that call the Popup function with several lines of text.
Runs usermessage.vbs, which shows a popup window with the specified text. The popup will stay on screen for up to 120 seconds, or until the user clicks the OK button.
Deletes the usermessage.vbs file.
In summary, the purpose of the batch file is to show this message box for up to 2 minutes:
It seems a bit contrived, but perhaps this code is a sample you created for testing? No doubt your “real” code is more practical and exciting. 🙂
AlwaysUp runs your batch file properly
AlwaysUp launches the batch file as a Windows Service just fine. And it has no problem running the dynamically created VBScript file either. We’re lucky to have hundreds of customers using AlwaysUp to launch their batch files, every day.
Indeed, we were able to setup your batch file in AlwaysUp and confirm that it runs as expected. Process Explorer showed AlwaysUp running the batch file, which launched the Windows Script Host executable (wscript.exe) to display the popup window. You can see this arrangement in the tree of processes on the left:
All good, right? Well, not entirely…
Session 0 Isolation prevents you from seeing the popup window
Even though your script is running, you will not be able to see the popup window on your desktop. That is because of Session 0 Isolation — an important security measure that constrains Windows Services.
You won’t see the popup because:
your batch file is running in Session 0, on the special background desktop where all Windows Services operate, and
Windows isolates applications running in Session 0, meaning that they cannot show up alongside the other windows on your screen.
Once upon a time, you were be able to switch to Session 0 to see the popup but no longer. Unfortunately, Microsoft removed that capability a few years ago. As a result, there is no way to see a window displayed in Session 0.
So in summary, your batch file will not pop up a window on your interactive desktop when you run it as a Windows Service. And that’s true even if you don’t use AlwaysUp because the restriction is built into Windows itself.
I hope this makes sense. Unfortunately, Session 0 Isolation can be tricky to comprehend. Please check out these FAQ entries if you want to dig into the details (caveat emptor):
And please be sure to get in touch if you have any other questions.
Best of luck with your project!