Running a *.BAT File at start up using a shortcut

User avatar
hlewton
PlatinumLounger
Posts: 3788
Joined: 24 Oct 2010, 23:39
Location: Canton, Ohio USA

Running a *.BAT File at start up using a shortcut

Post by hlewton »

I can create a shortcuts on my desktop by Right Clicking>New>Shortcut with no problem. In trying to make a bat file run at start up I ran into how to create a shortcut and it said to Right Click a blank space on the Windows desktop, a folder, or in a directory. Choose New then select Shortcut. This only works for me on the Desktop. Why wouldn’t I be able to create shortcuts in all the locations the article I read says? The only option available after choosing "New" is to create a new folder in all the locations other then the desktop.
Regards,
hlewton

User avatar
HansV
Administrator
Posts: 78236
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Running a *.BAT File at start up using a shortcut

Post by HansV »

This is what I see when I click an empty part of a folder - I'm using Windows 11, so it looks slightly different, but the New > Shortcut option should be there in Windows 10 too. Make sure that you do not right-click on a file or subfolder, but in an empty spot.

S0888.png
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans

User avatar
hlewton
PlatinumLounger
Posts: 3788
Joined: 24 Oct 2010, 23:39
Location: Canton, Ohio USA

Re: Running a *.BAT File at start up using a shortcut

Post by hlewton »

OK, I have never before done that. I see what you're saying but the only empty spots I see are to the left of the file names. I assume that is where I should be. I can't click on the folder itself, which is what I assumed I was supposed to do.

Thanks.
Regards,
hlewton

User avatar
StuartR
Administrator
Posts: 12577
Joined: 16 Jan 2010, 15:49
Location: London, Europe

Re: Running a *.BAT File at start up using a shortcut

Post by StuartR »

Depending on the view you have selected, there is plenty of white space to the right of the explorer window where you can right-click - or you can click below all the files
StuartR


User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15498
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: Running a *.BAT File at start up using a shortcut

Post by ChrisGreaves »

hlewton wrote:
17 Nov 2021, 12:45
... but the only empty spots I see are to the left of the file names
The extravagantly large image shows by an arrow where I right-clicked to obtain "New" and "Shortcut".
I temporarily created the white space by narrowing the details columns, as shown by my markings along the column headings.

I hope that this helps!

Tip: I no longer use "AutoExec.bat" as my filename. My current boot sequence is "Auto20211028.bat, and in that way i can presevre an audit trail of versions of the critical boot sequence.

Tip: My auto batch file includes:-

Code: Select all

::
::	Make a backup copy of the latest use of this batch file.
::
		COPY %0 T:\BatLap
so that the boot sequence makes a copy of itself (at boot time) to my data drive. That way I can exsperiment with the copy on drive T without corrupting the current working copy in "C:\Users\Chris075\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup".

Cheers
Chris
You do not have the required permissions to view the files attached to this post.
An expensive day out: Wallet and Grimace

User avatar
Leif
Administrator
Posts: 7193
Joined: 15 Jan 2010, 22:52
Location: Middle of England

Re: Running a *.BAT File at start up using a shortcut

Post by Leif »

hlewton wrote:
17 Nov 2021, 12:10
IIn trying to make a bat file run at start up I ran into how to create a shortcut...
I'm not quite understanding what you want - are you trying to create the BATch file, or the shortcut to the BATch file?
If the second, try right-clicking on the BATch file, and select 'Create shortcut'. Once created, just drag the shortcut to wherever you want it.
Leif

User avatar
hlewton
PlatinumLounger
Posts: 3788
Joined: 24 Oct 2010, 23:39
Location: Canton, Ohio USA

Re: Running a *.BAT File at start up using a shortcut

Post by hlewton »

ChrisGreaves wrote:
17 Nov 2021, 15:48
hlewton wrote:
17 Nov 2021, 12:45
... but the only empty spots I see are to the left of the file names
The extravagantly large image shows by an arrow where I right-clicked to obtain "New" and "Shortcut".
I temporarily created the white space by narrowing the details columns, as shown by my markings along the column headings.

I hope that this helps!

Tip: I no longer use "AutoExec.bat" as my filename. My current boot sequence is "Auto20211028.bat, and in that way i can presevre an audit trail of versions of the critical boot sequence.

Tip: My auto batch file includes:-

Code: Select all

::
::	Make a backup copy of the latest use of this batch file.
::
		COPY %0 T:\BatLap
so that the boot sequence makes a copy of itself (at boot time) to my data drive. That way I can exsperiment with the copy on drive T without corrupting the current working copy in "C:\Users\Chris075\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup".

Cheers
Chris
Yep, I see it now. I never thought to go all the way to the right. Thanks for that.

I am going to try to explain what I want to do in my following post.
Regards,
hlewton

User avatar
hlewton
PlatinumLounger
Posts: 3788
Joined: 24 Oct 2010, 23:39
Location: Canton, Ohio USA

Re: Running a *.BAT File at start up using a shortcut

Post by hlewton »

Leif wrote:
17 Nov 2021, 16:02
hlewton wrote:
17 Nov 2021, 12:10
IIn trying to make a bat file run at start up I ran into how to create a shortcut...
I'm not quite understanding what you want - are you trying to create the BATch file, or the shortcut to the BATch file?
If the second, try right-clicking on the BATch file, and select 'Create shortcut'. Once created, just drag the shortcut to wherever you want it.
I have one computer that is not always showing up in the Network option in Windows File Explorer on my other computers. Quite some time ago I created a bat file to stop and then Start the Function Discovery Resource Publication on that computer. That bat file is on the Desktop. It makes that computer show up after manually running that bat file. I have tried all the recommended settings for the Function Discovery Resource Publication in Windows Services and nothing makes it work correctly except the bat file. So I thought I would try having the computer run it at Startup by putting a copy of the Desktop shortcut in Windows 10 All Users Startup folder. If I copy that shortcut to that folder do you think that would work?
Regards,
hlewton

User avatar
HansV
Administrator
Posts: 78236
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Running a *.BAT File at start up using a shortcut

Post by HansV »

It's certainly worth a try!
Best wishes,
Hans

User avatar
StuartR
Administrator
Posts: 12577
Joined: 16 Jan 2010, 15:49
Location: London, Europe

Re: Running a *.BAT File at start up using a shortcut

Post by StuartR »

I did something very similar. I created a BAT file that stopped and restarted FDResPub
I use task scheduler to run this, with admin privileges, each time I log in
StuartR


User avatar
hlewton
PlatinumLounger
Posts: 3788
Joined: 24 Oct 2010, 23:39
Location: Canton, Ohio USA

Re: Running a *.BAT File at start up using a shortcut

Post by hlewton »

StuartR wrote:
17 Nov 2021, 19:33
I did something very similar. I created a BAT file that stopped and restarted FDResPub
I use task scheduler to run this, with admin privileges, each time I log in
I am not at all sure how to do that. I found and opened Task Scheduler but from there I don't know what to do.

What I see is in the attachment. Would go to the Actions section, create a task and paste the same thing that is inside my bat file? Then I assume it will ask me when I want to run it and if Admin privileges should be given to it. Is this sorrect?
Task Scheduler.jpg
You do not have the required permissions to view the files attached to this post.
Regards,
hlewton

User avatar
StuartR
Administrator
Posts: 12577
Joined: 16 Jan 2010, 15:49
Location: London, Europe

Re: Running a *.BAT File at start up using a shortcut

Post by StuartR »

Click Create task, you will see this form, with five tabs.
General.png
On the general tab, give your scheduled task a name
On the Triggers tab, click new, then Begin the task "At log on", any user (or at Startup if that is what you want)
On the Actions tab, click new, then "Start a program", and browse to your bat file.

OK your way out of all the boxes and you should be all set
You do not have the required permissions to view the files attached to this post.
StuartR


User avatar
hlewton
PlatinumLounger
Posts: 3788
Joined: 24 Oct 2010, 23:39
Location: Canton, Ohio USA

Re: Running a *.BAT File at start up using a shortcut

Post by hlewton »

StuartR wrote:
18 Nov 2021, 08:19
Click Create task, you will see this form, with five tabs.
General.png
On the general tab, give your scheduled task a name
On the Triggers tab, click new, then Begin the task "At log on", any user (or at Startup if that is what you want)
On the Actions tab, click new, then "Start a program", and browse to your bat file.

OK your way out of all the boxes and you should be all set
Thank you very much. I am going to give it a try right now.
Regards,
hlewton

User avatar
hlewton
PlatinumLounger
Posts: 3788
Joined: 24 Oct 2010, 23:39
Location: Canton, Ohio USA

Re: Running a *.BAT File at start up using a shortcut

Post by hlewton »

StuartR wrote:
18 Nov 2021, 08:19
Click Create task, you will see this form, with five tabs.
General.png
On the general tab, give your scheduled task a name
On the Triggers tab, click new, then Begin the task "At log on", any user (or at Startup if that is what you want)
On the Actions tab, click new, then "Start a program", and browse to your bat file.

OK your way out of all the boxes and you should be all set
Well I did it all but it would not allow me to create the task without assigning a password. I don't use passwords. Is there a way around that? If I have to use a password does it ask for it as the computer is booting up? Sorry but I have never used a password for my computers and I think adding one now would mess up my connections to my other computers ability to access that particular computer.
Regards,
hlewton

User avatar
StuartR
Administrator
Posts: 12577
Joined: 16 Jan 2010, 15:49
Location: London, Europe

Re: Running a *.BAT File at start up using a shortcut

Post by StuartR »

You can't do this if you don't use passwords
StuartR


User avatar
hlewton
PlatinumLounger
Posts: 3788
Joined: 24 Oct 2010, 23:39
Location: Canton, Ohio USA

Re: Running a *.BAT File at start up using a shortcut

Post by hlewton »

StuartR wrote:
18 Nov 2021, 14:20
You can't do this if you don't use passwords
OK, that is what I was afraid of. However, I think I have what I need. I opened the shell:common startup folder and placed the bat file in it. I watched it boot up and it opened the command window and ran it as usual. The only thing different was when it got to the last command in the bat file - net start "Function Discovery Resource Publication" it made the command window huge but it did close. This doesn't happen when run manually, but I believe it worked. I can see that computer on other computers, at least today I can. We'll see what tomorrow brings.

Thanks for your help.
Regards,
hlewton