jana
asked on
Problem running batch files in startup Windows 8
We have a DOS batch file in our Windows 8 Startup folder (and in Startup Tab in Task Manager) that seems never to run when the PC starts up. How can we have a batch file running automatically in windows when the computer starts.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Didn't work and tried it twice. Checked if it created any event to see why it didn't, but nothing.
- Does the batch file access the network/domain? That could be a reason.
- Try temporarily replacing the .bat with a simple one. Just to see if it works. Maybe with a single line of code that writes text to a file:
- Try temporarily replacing the .bat with a simple one. Just to see if it works. Maybe with a single line of code that writes text to a file:
>> "%temp%\startupresult.txt" echo %date% %time% echo "%0" computername:%computername% username:%username%
ASKER
It's a local PC, no LAN.
Will try with your example and see.
Will try with your example and see.
ASKER
Didn't work.
Did noticed that if the application "Task Scheduler" is open, it works. We change the trigger to open run the command when "Locked" and it worked. But when we closed the "Task Scheduler" and locked again the PC, it didn't. Seems to need to have the apps open.
Please advice.
Did noticed that if the application "Task Scheduler" is open, it works. We change the trigger to open run the command when "Locked" and it worked. But when we closed the "Task Scheduler" and locked again the PC, it didn't. Seems to need to have the apps open.
Please advice.
I just tested and it works here...
Windows 7.
- Add basic task.
- Trigger: When the computer starts
- Start a program
- Program/script: cmd
- Add arguments: /c c:\foldername\filename.bat
For filename.bat:
On the last page of the basic task setup, check box "Open properties dialog for this task..."
- Under General tab...
- Change user/group. Browse. Type system. Pick OK. Back in the General tab, it shows as NT AUTHORITY\SYSTEM.
- Pick OK to close.
- Reboot.
- After you logon (probably even after it starts - I've not confirmed), startupresult.txt is created under c:\windows\temp
Windows 7.
- Add basic task.
- Trigger: When the computer starts
- Start a program
- Program/script: cmd
- Add arguments: /c c:\foldername\filename.bat
For filename.bat:
>> "%temp%\startupresult.txt" echo %date% %time% echo "%0" computername:%computername% username:%username%
Note: startupresult.txt is created under c:\windows\tempOn the last page of the basic task setup, check box "Open properties dialog for this task..."
- Under General tab...
- Change user/group. Browse. Type system. Pick OK. Back in the General tab, it shows as NT AUTHORITY\SYSTEM.
- Pick OK to close.
- Reboot.
- After you logon (probably even after it starts - I've not confirmed), startupresult.txt is created under c:\windows\temp
ASKER
Thanx! I forgot the CMD.
Worked!!!!
Worked!!!!
Awesome! I'm glad...
ASKER
One last question:
Why placing the shortcut of the batch file in the startup folder didn't work?
(we placed it on 'C:\Users\user-name\AppData \Roaming\M icrosoft\W indows\Sta rt Menu\Programs\Startup')
Why placing the shortcut of the batch file in the startup folder didn't work?
(we placed it on 'C:\Users\user-name\AppData
IDK. I just tested on my windows 8 RT, which also didn't work. It could be a safety/security thing.
ASKER
Ok will proceed to close.
Since we deployed 8.1 domain wide more than a year ago, I can tell you that the problem is something completely different.
Establishing a task that uses a startup trigger will not help. Now you will ask "but Rayluvs wrote, that it helped" - correct, but it will not under normal circumstances, which are: users shutdown their computers in the evening and turn them back on next morning. The startup task is fired on startup. What is a startup in 7, what is a startup in 8.x? Astoundingly, these are different things. With win8, Microsoft introduced "fast startup" and "kernel hibernation". Whenever you shutdown win8 and turn it on again, it does NOT perform a startup but just a resume from kernel hibernation. Startup scripts will NOT run, tasks with the startup trigger will not run, neither will GPO based MSI installations run.
If however you select "restart", a real restart is performed. So to use startup scripts on a daily base, we would indeed have to turn off one of the most desirable features of win8.x: "fast startup".
Establishing a task that uses a startup trigger will not help. Now you will ask "but Rayluvs wrote, that it helped" - correct, but it will not under normal circumstances, which are: users shutdown their computers in the evening and turn them back on next morning. The startup task is fired on startup. What is a startup in 7, what is a startup in 8.x? Astoundingly, these are different things. With win8, Microsoft introduced "fast startup" and "kernel hibernation". Whenever you shutdown win8 and turn it on again, it does NOT perform a startup but just a resume from kernel hibernation. Startup scripts will NOT run, tasks with the startup trigger will not run, neither will GPO based MSI installations run.
If however you select "restart", a real restart is performed. So to use startup scripts on a daily base, we would indeed have to turn off one of the most desirable features of win8.x: "fast startup".
ASKER
Hey Thanx a LOT!!! Really helped us understand!!! Wish it was entered prior awarding because it deserves it!!!
ASKER