• Status: Solved
  • Priority: Low
  • Security: Public
  • Views: 44
  • Last Modified:

How to run a batch file successfully in the user Startup Folder.

We want to have a batch file open when the user logs on every time.  The batch file has a shortcut to it with admin rights and the shortcut is copied at the startp folder (that is "C:\Users\username\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup").  Yet, when the PC restart or re-log in, it don't start, all other apps in the startup folder runs, but not the batch file.

Please advice.
0
rayluvs
Asked:
rayluvs
  • 11
  • 3
  • 3
  • +1
1 Solution
 
David Johnson, CD, MVPOwnerCommented:
put the batch file in C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp
or
use task scheduler to run the batch file on user login with highest privileges
0
 
rayluvsAuthor Commented:
will try
0
 
rayluvsAuthor Commented:
Didn't work.  Just doesn't display.

So strange.

I have text files, other apps in the user startup folder not the windows, and all of them start - the batch file doesn't.

What else can it be?
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
rayluvsAuthor Commented:
Placed "paused" statement to see if it passes through this batch file, and nothing; it just goes thru.
0
 
rayluvsAuthor Commented:
Did noticed that the batch file is not in the Startup folder of Task manager, everything else except the batch file....

please advice
0
 
aravind ancheWindows/Vmware Commented:
Place the  batch file in particular location and use run registry to that
0
 
rayluvsAuthor Commented:
What do you mean by "... and use run registry to that"?
0
 
aravind ancheWindows/Vmware Commented:
For example
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
"Proxy"="C:\\Windows\\System32\\proxy.cmd"
if you have batchfile called proxy place that in a location, In example here I placed in C:\\Windows\\System32\\proxy.cmd place that in run registry, It run everytime the system starts
0
 
rayluvsAuthor Commented:
Understood, will try.
0
 
rayluvsAuthor Commented:
Thank you!  Just tried it and it works!

Why placing the shortcut in windows startup doesn't work?
0
 
aravind ancheWindows/Vmware Commented:
you Must be aware that some program needs Administrative privilege to start. Keeping program simply in startup folder doesn't provide the program permission to execute it.

You either need to remove the Option to run program as administrator.
0
 
rayluvsAuthor Commented:
Yes it has the admin privileges.
0
 
rayluvsAuthor Commented:
It's ok... u already helped me getting on automatic at every startup.

Thanx
(we'll figure out)
0
 
McKnifeCommented:
That is not a solution.
Scripts in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run do not run elevated.

Solution: create a scheduled task - David told you and you tried. Of course, it does not display when run with different credentials and elevated - that is normal. But the executable or script does run elevated ("with administrative permissions").
0
 
rayluvsAuthor Commented:
the shortcut has been elevated with the privileged run as admin, but didn't work.  The registry has been working (would've preferred just placing the shortcut in startup or schedule, but no luck - with batch files - all else do work in startup)
0
 
McKnifeCommented:
Rayluvs, there is something strange. That registry location does not elevate, sorry, so unless your UAC is off and at the same time The user is administrator, it cannot possibly do system changes elevated.
0
 
rayluvsAuthor Commented:
Yes the user is admin.
0
 
McKnifeCommented:
And UAC? Off or on?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 11
  • 3
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now