Solved

Start Bat, restart if closed?

Posted on 2014-01-06
7
351 Views
Last Modified: 2014-02-15
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.
0
Comment
Question by:Pancake_Effect
7 Comments
 
LVL 68

Expert Comment

by:Qlemo
ID: 39760740
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" .
0
 
LVL 19

Accepted Solution

by:
Thommy earned 500 total points
ID: 39761348
Maybe there is some kind of restart tool installed on your computer.

Have a look at following tools...
Tools to Automatically Restart a Crashed or Closed Application
0
 
LVL 32

Expert Comment

by:sarabande
ID: 39762468
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
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 4

Author Comment

by:Pancake_Effect
ID: 39762816
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 :(

no option for log on as

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.
0
 
LVL 68

Expert Comment

by:Qlemo
ID: 39763084
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).
0
 
LVL 4

Author Comment

by:Pancake_Effect
ID: 39804224
Autologon will handle login startup items your saying?
0
 
LVL 68

Expert Comment

by:Qlemo
ID: 39804247
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"
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

I previously wrote an article addressing the use of UBCD4WIN and SARDU. All are great, but I have always been an advocate of SARDU. Recently it was suggested that I go back and take a look at Easy2Boot in comparison.
Citrix XenApp, Internet Explorer 11 set to Enterprise Mode and using central hosted sites.xml file.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now