Link to home
Start Free TrialLog in
Avatar of Pancake_Effect
Pancake_EffectFlag for United States of America

asked on

Start Bat, restart if closed?

Okay so we have a kiosk at work we got a while back. When you first log in it brings up a command line window that brings up the IE homepage. If you close out of either the homepage or the bat CMD that brought the home page up, it restarts IE and brings the homepage back up.Because it's a kiosk, this is handy because it restarts if the user exit's out of it.

Long story short, I had to delete the profile for reasons that don't matter and now it stopped working. Before I deleted it, I backed up the bat that opened the IE but I tried looking everywhere for whatever made that bat file open in the first place.

I looked to see if it was a scheduled task, another batch running, and I could not figure it out. It was none of them.


So can anyone tell me what they did, or how to make that bat open again automatically?


Just to recap, I have a bat file that opens up our internet homepage, if you close it, it opens back up again.

How do I do this again? I have the bat, I just need it to automatically open again like it was doing before. This is on a XP machine.
Avatar of Qlemo
Qlemo
Flag of Germany image

Most probably the Explorer.Exe was replaced as Windows GUI. The corresponding key is
HKEY_Current_User\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon. Change the value Shell to "cmd /c c:\PathToBatch\BatchFile.cmd" .
ASKER CERTIFIED SOLUTION
Avatar of Thommy
Thommy
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
from your description it sounds as the bat file wouldn't start at all now?

if that is true, you could add it to the startup folder of the new user (profile).

alternatively you may add a new string entry to the

  HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run

the name of the string entry is arbitrary and the value is the full path to the batch file.

if you do either method, it would start the batch at login again.

the technique to restart the batch when closing the IE or the batch file could be done in the batch file itself. if for example the last statement in the batch file is a call to itself it would restart when IE was closed.

however that would not prevent the user from closing the bat file. this could be achieved by starting the batch file with the start /B command. doing so, the batch file only could be stopped by CTRL+BREAK.

note, they also could have used other techniques. it is rather simple to write a launcher of a batch file or download one and windows has various possibilities to make it run like you described.

Sara
Avatar of Pancake_Effect

ASKER

Thanks everyone for the help. While I'm not sure how they originally did it, I do have a guess. I'm thinking that they made the bat a service. I've been playing with it, and I made it a service and it works just like they had it. However I run into a problem that I can make the service run as the certain user. It only works with the local user because it gives me the option to run on the desktop. I need it to run as the currently logged in domain user :(

User generated image

I'll play with the other options you guys have given me. I think your guy's options will work, and I will give it a try. But just for my own curiosity I was trying to figure out what they used originally because it was so smooth, it's going to bug me :P  I know it came heavy with a lot of options configured to use Sysinternals, I was looking to see if there was one program in Sysinternals that had a feature like this.
Since you only deleted the original user profile, it cannot have been a service. A service is defined at machine level, not user level.
And yes, you can't provide the "current logged-in user" as service account, only specific ones, and only Local System can access the user's session for interaction (and only on a different, sandboxed display, for security reasons).

Startup Folder will not help. It is run by the Explorer.exe started on log in, and with that you have Start Button, Task Manager aso., which again need to be prohibited with GPOs or registry settings.

All settings for a user profile require that the user is logged in automatically. That can be managed with SysInternals AutoLogon, which will set registry keys and store the password int local SAM (for keeping it encrypted).
Autologon will handle login startup items your saying?
No, it will just set up that a specific user is logged in automatically. Whether the usual Explorer shell is started then, again starting StartUp folder items, is not its business.

If you change the Shell registry key as stated above, the command will run. But terminating the command will not restart, that needs an addition:
   "cmd /c c:\PathToBatch\BatchFile.cmd & logoff"