×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

How to automate a troublesome startup ?

How to automate a troublesome startup ?

How to automate a troublesome startup ?

(OP)
PushBullet no longer opens reliably at Windows Startup. If I end its multiple entries in Task Manager's Background Processes, then clicking on the StartUp shortcut becomes effective. So I need a batchfile (?) that checks for those multiple entries in Task Manager's Background Processes, and ends them, and then activates the startup shortcut. A shortcut to this process can replace the PushBullet shortcut in StartUps.

RE: How to automate a troublesome startup ?

How about removing that program from Startup completely and creating a task in Task Manager that runs "after" startup and launches the program ?
Would that not solve the problem ?

I've got nothing to hide, and I demand that you justify what right you have to ask.

RE: How to automate a troublesome startup ?

I think pmonett is likely on the right path, but to further expand on what you asked see the link:
https://stackoverflow.com/questions/33822/any-way-...
Then you would simply add another line to the file to launch the program from its location. Pretty simple, but also unnecessary if you do it as pmonett lists above.

Learning - A never ending quest for knowledge usually attained by being thrown in a situation and told to fix it NOW.

RE: How to automate a troublesome startup ?

(OP)
It sounds like it might; but I am not aware of the ability to do that in Task Manager; theoretically Task Scheduler might, but it is triggered by 'the clock', not an event like Windows StartUp. I'd love to discover HOW that can be done.

RE: How to automate a troublesome startup ?

Using Task Scheduler may be overly complex. All the OP needs is for a process to not run until a wait timer expires.

Why not use a batch file in the startup folder and call the built-in timeout command? For example, a 10 seconds delay:

CODE -->

TIMEOUT /T 10
START "" "C:\Program Files (x86)\Pushbullet\pushbullet.exe" 

Hope this helps...

RE: How to automate a troublesome startup ?

(OP)
I've discovered I was wrong about Task Scheduler - it CAN be triggered by an event, as well as the clock.

I've also discovered that it is not just a delay that is needed to allow PushBullet to launch. Somehow, up to three PushBullet entries can appear in Task Manager's Background Processes. If THEY are ENDed, PushBullet will launch faultlessly. Someone kindly constructed a batch file for me that ENDs those background processes before running the PushBullet launcher. And yes, the batch file incoporated delays. I believe the problem has been solved.

RE: How to automate a troublesome startup ?

Good to hear. Thanks for posting back.

RE: How to automate a troublesome startup ?

(OP)
Turns out that it is inconsistent - unreliable (as I have found macros/batch-files to usually be).

RE: How to automate a troublesome startup ?

Surely the solution is to not have the PushBullet executable running from startup at all but to use a script to a) check for its presence, b) fire it to do what you want; and c) stop the pushbullet process afterwards?

Perhaps use PowerShell or something like AutoHotkey to start and stop PushBullet?

RE: How to automate a troublesome startup ?

(OP)
I understand 'a)', but do not know how to implement that; I do NOT understand 'b)'; and as for 'c)', stop it after what ?

RE: How to automate a troublesome startup ?

You don't know how to stop PushBullet from running automatically? Try using the small, free, portable Autoruns and remove the tick from the PushBullet startup process.

Pseudo-code for b) and c):

CODE -->

pb = <filepath to pushbullet.exe>
If process $pb not exist
Start $pb Do
<whatever1> <whatever2> <whatever...?> End Do
Stop $pb
EndIf

(You shouldn't even need the conditional EndIf statement.)

RE: How to automate a troublesome startup ?

(OP)
I want PushBullet to launch and run - why include a STOP in the batchfile ?

RE: How to automate a troublesome startup ?

Because leaving it running would interfere with the next time it was called. just remove the STOP statement and remember to close PushBullet manually.

RE: How to automate a troublesome startup ?

(OP)
As I said before, the batch file is unreliable. It has worked, but it has also failed - and just left an open "DOS" window.
I'm quite confused by the autohotkeys suggestion.
By experimentation I've established that "taskkill /IM pushbullet.exe" can END the PushBullet Background Process in Task Manager, but can also fail to end it. PushBullet will not launch if there is a PushBullet Background Process left in Task Manager, but will if that PushBullet Background Process is ended. So the issue seems to have become the ENDing of ALL the PushBullet Background Processes in Task manager.

RE: How to automate a troublesome startup ?

Are you using the /F parameter to force close the pushbullet process(es)?

CODE -->

taskkill /IM pushbullet.exe /F 

RE: How to automate a troublesome startup ?

(OP)
No, I did not use /F - that may well be the solution to my problem, the ending does not always happen.

I have now included the '/F', and will have to experience a few reboots to see if that fixed it.

At the next reboot, a Pushbullet Background Process prevented launching of Pushbullet; so '/F' was NOT the solution I needed.

RE: How to automate a troublesome startup ?

So you obviously still have it autostarting, which you were advised to put a stop to in the second post.

Instead of a batch file using taskkill /IM pushbullet.exe /F; try PowerShell:

CODE -->

Get-Process pushbullet|Stop-Process 

or, perhaps better;

CODE -->

Get-Process pushbullet -ErrorAction SilentlyContinue | Stop-Process -PassThru 

RE: How to automate a troublesome startup ?

(OP)
I did not 'stop it as advised' because it made no sense to me to stop PushBullet when I want it opened. I obviously do not understand the situation. Before using Powershell, I want to report, that the launch process has proceeded satisfactorily several times; however,when it does not succeed, a 'DOS' window is left open with comments about Timeout and that Pushbullet can not be found. If I then look at the Background Processes in Task Manager, I find that there are one or more PushBullet entries there; if I manually end those and retry, that 'DOS' window still opens and still complains about Timeout and an unfindable PushBullet, yet PushBullet launches successfully, and the querulous 'DOS' window simply closes. My conclusion for what it is worth, is that it is the ineffectual attempts at closing the Background Process entries which is preventing success.

I would like to see if Powershell can improve on this, but would like more guidance on how to implement that.

I've discovered that something had corrupted the batch file, and when that was corrected, Pushbullet launched as required, even though the 'DOS' window was still
complaining about errors. Maybe it has finally been solved.

RE: How to automate a troublesome startup ?

Quote:

I've discovered that something had corrupted the batch file

In my experience corrupted batch files just fail to run. However, I'm pleased your issue may now be solved.

RE: How to automate a troublesome startup ?

(OP)
Sad to say - NOT the end of it. Obviously the whole process CAN work satisfactorily, but often does not. Invariably, ENDing the Background Process entries in Task Manager removes the obstacle to a proper launch. So the code is NOT ENDing ALL the Background Process entries in Task Manager; I am quite interested to see if using Powershell makes that ENDing more effective; but I'd like guidance on how to do that.

RE: How to automate a troublesome startup ?

You admitted to not following previous advice. I lost interest at that point.

RE: How to automate a troublesome startup ?

(OP)
I did, but I also wrote later that I OBVIOUSLY did not understand the situation, as it makes no sense to shutdown what you are trying to achieve. A pity you have lost interest - I'm not being obstinate, but uncomprehending.

If your interest is not completely dead, could you tell me what it is I have to stop - and what it is I should do in Powershell, since taskkill in the batchfile is unreliable.

It seems you have already given me Powershell code - what do I do with that ? - paste it into a text file and call it whatever.cmd ?

RE: How to automate a troublesome startup ?

Download, unzip and run AutoRuns... like I advised in post 11.

Find the entry (or entries) for Pushbullet and remove the tick against their checkbox(es). This will stop them running from startup.

Close AutoRuns and reboot.

Your batch file running from a shortcut should now work.

RE: How to automate a troublesome startup ?

(OP)
Thank you for not quitting. I have found a 'Run Pushbullet at startup' in PushBullet Settings which I have disabled. We'll see what difference that makes ...
You clearly wrote Autoruns, which I already have installed; but I read Autohotkey and that really confused me. You can see you are dealing with a basketcase, rather than an obdurate.

RE: How to automate a troublesome startup ?

AutoHotkey, like PowerShell is a scripting language. It's useful for automating things, like If process exists, do this. As such, it's often more flexible than a batch file.

AutoRuns is quite different. It lists everything that runs automatically from startup, grouped by the different startup methods (user startup folder, registry, scheduled task, etc.).

RE: How to automate a troublesome startup ?

(OP)
Unticking the 'start with windows' in PushBullet was not enough to solve the problem. There was still a blocking entry in Background Processes, which when ended, allowed PushBullet launch. I have found a pushbullet.lnk in AutoRuns - and unticked it - We'll see if that helps. I am sure it links to the batchfile NOT the program. To my mind it should prevent running the batch and so the launching of PushBullet.

So let's go with the premise that Powershell is more effective than a batchfile; how do I do the batchfile equivalent in Powershell ?

RE: How to automate a troublesome startup ?

Can you post a screenshot of the entry you disabled in Autoruns?

RE: How to automate a troublesome startup ?

(OP)

RE: How to automate a troublesome startup ?

That's almost undoubtably created by Pushbullet itself and nothing to do with any batch file.

Can you post the batch file?

RE: How to automate a troublesome startup ?

(OP)
Disabling did not achieve success; moreover, the PATH clearly points to the batchfile - C:\data\batch files\dos or cmd\pushbullet.bat

RE: How to automate a troublesome startup ?

(OP)
@echo off
taskkill /IM pushbullet.exe /F
timeout 2
taskkill /IM pushbullet.exe /F
timeout 2
taskkill /IM pushbullet.exe /F
timeout 2
"c:\program files\pushbullet\pushbullet.exe"

RE: How to automate a troublesome startup ?

You're right. I just looked at the startup location, not the path.

What I don't understand is why you even need a batch file (or alternative) at all now after "Unticking the 'start with windows' in PushBullet".

If Pushbullet is still starting automatically even after "Unticking the 'start with windows' in PushBullet" then the startup location should show in Autoruns.

PS - I can see why you had the errors with the batch file.

RE: How to automate a troublesome startup ?

(OP)
You mean there are still errors in the batch file ?
The one I referred to was an unintended addition of text that happened accidentally, and which I removed, so it is not visible NOW.

Please point out the errors to me, maybe fixing them will solve my problem.

I will test this, but without the batchfile and with 'start with windows' unticked, I expect NO launching.

Sure enough, NO sign of launching; and NO entry in Background Processes.

You have not given me a way to do it in Powershell - have you changed your mind about Powershell ?


RE: How to automate a troublesome startup ?

If taskkill is used against a non-existing process it will show an error.

Say you have two background pushbullet processes running. Your batchfile should kill them both... but the third call to taskkill will have no named process to work on so will show an error.

PowerShell's Stop-Process cmdlet is smarter. It'll kill all instances of the named process without the command needing to be repeated... and, if used with -ErrorAction SilentlyContinue, will just move to the next instruction (if any) without any error. However, PowerShell scripts are disabled in the OS by default so this needs to be taken into account.

AutoHotkey, by comparison, allows for a If process exists construct which will do the same as PowerShell's Stop-Process and exit gracefully once the condition is no longer 'True', i.e. if the process no longer exists.

As a result, both PowerShell and AutoHotkey are more 'graceful' than taskkill.

This is all beside the point... i.e. if Pushbullet didn't start automatically then surely you wouldn't have a problem?

As a matter of interest:
1) What Windows edition and version are you using?
2) What version of Pushbullet do you have installed?

I ask because I may have to install Pushbullet myself just to see how it sets itself up.

BTW, looking at your Autoruns screenshot... remove the tick against the 'autohotkey.lnk' entry for the time being so it doesn't confuse the issue any further.

It's now 5 am here so I'm going to sleep.

RE: How to automate a troublesome startup ?

(OP)
'It's now 5 am here so I'm going to sleep.' A VERY wise move.

"if Pushbullet didn't start automatically then surely you wouldn't have a problem?"
I WANT Pushbullet to start - which is why I originally baulked at stopping it - even if I misunderstood what you meant.

As a matter of interest:
1) What Windows edition and version are you using? - x32Win10ProV21H1
2) What version of Pushbullet do you have installed? - It installs v338 and IMMEDIATELY updates to v400.

BTW, looking at your Autoruns screenshot... remove the tick against the 'autohotkey.lnk' entry for the time being so it doesn't confuse the issue any further.

I'm reluctant to disable autohotkey.lnk, because I use it extensively to enter text strings. Confusion arose from my (inexplicable) misreading of Autoruns as Autohotkeys - I don't think that is a good reason to interfere with its workings.

RE: How to automate a troublesome startup ?

My mistake... I thought you were using AutoHotkey to try to launch Pushbullet. Ignore what I said.

Well, some progress. I prepped a clean install of Win 10 Pro 21H1 and installed Pushbullet then rebooted. Before connecting to the internet I did a search with Autoruns and found an entry for it:



I checked Task Manager and found 2 Pushbullet background processes... same as you.



I tried to run Pushbullet from a desktop shortcut and couldn't get it to appear. I ended both background processes and tried the desktop shortcut again... to no avail.

I went back to Autoruns and removed the tick against Pushbullet then rebooted. This time there were no Pushbullet background processes... but still the desktop shortcut didn't work. So... similar symptoms to you but not identical.

I rebooted, connected to the internet then tried the desktop shortcut again... and saw Pushbullet updating:



I rebooted and the desktop shortcut worked.

I went back to Autoruns and put the tick back in the Pushbullet entry and rebooted.

Pushbullet now starts automatically so I don't need to use the desktop shortcut. (I haven't gone any further 'cos I have neither Google nor Facebook accounts.)

Conclusion: I don't think you need a script to automate opening Pushbullet at all. I think there's some glitch with your installation, probably in the entry for Pushbullet in the HKCU registry 'Run' key. Have you tried uninstalling/reinstalling to see if this fixes things? Post back with the result.

If a re-install doesn't fix it for you then I'll do another clean install and check I can duplicate the issue and what I did to fix it. I'll also copy the registry 'Run' key before and after Pushbullet is fixed in order to compare the two.

RE: How to automate a troublesome startup ?

(OP)
I did a fresh install earlier this month, and sometimes it launched and other times it didn't.

RE: How to automate a troublesome startup ?

Was this 'fresh install' over the top of the existing install or did you uninstall using something like Revo Uninstaller Free which also checks afterwards for left-overs (especially registry entries) and removes them?

RE: How to automate a troublesome startup ?

(OP)
It was after using Revo.
I have evidence from another program that Revo does not remove ALL traces of a program. When that other program was re-installed it remembered settings.

RE: How to automate a troublesome startup ?

Well, IMO, something odd is causing Pushbullet to sometimes launch automatically as more than one background process.

I've been watching the 'Processes' tab in Task Manager immediately after each restart.

If Pushbullet launches once as a background process then it will change after ~10 seconds... it will disappear from the 'Background processes' list and re-appear in the 'Apps' list, i.e. a successful launch of its 'Welcome/Sign in' dialog.

Conversely, if it launches twice as background processes then it fails... and subsequently trying to launch from a shortcut will also fail 'cos that'll launch a third background process, blocked by the others.

I suggest you watch Task Manager too, to see if you can confirm this behaviour.

You see that in Autoruns I filtered for pushbullet (shown at a) and found only one autorun entry... in the registry. But look at the -show false switch that's used (shown at b):



This shows that the program author clearly wants Pushbullet to run as a background process with no GUI initially (and I think I know why). An export of the relevant registry 'Run' key shows this clearly:

CODE --> REG

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
"Pushbullet"="\"C:\\Program Files (x86)\\Pushbullet\\pushbullet.exe\" -show false" 

I suspect the program author knows that the GUI will fail if there's no internet connection. I suspect the reason Pushbullet is launched as a background process is so it can test for internet connectivity. I wouldn't be surprised if you use Wi-Fi rather than ethernet. (Am I right?) Unfortunately Windows 10 takes longer than previous versions to signal that internet connectivity has been established (especially with Wi-Fi as this can vary). I suspect there's a timeout within Pushbullet that is insufficient for Windows 10. All this is supposition but, if I'm right, you will have to run Pushbullet from a script... and that script will need to check reliably for an internet connection before ever running Pushbullet.

I suggest you run Autoruns again (using the right-click Run as administrator option) and filter for pushbullet. The reason for this is because, if I'm right, running Pushbullet from an autorun entry is never going to be reliable.

Hope this helps...

RE: How to automate a troublesome startup ?

(OP)
Before you mentioned it, I had discover the FILTER option in Autoruns, and entered PushBullet'; the only result was for the batchfile in StartUps. But you have lost me with the 'show-false' etc.
If there is a 'lack-of-internet' issue, I can avoid that by delaying the StartUp batchfile suitably, because I have changed my routine to turn off the modem every night; and start the modem and the PC simultaneously in the morning. I do NOT use WiFi - the PC is connected to the modem by ethernet.

RE: How to automate a troublesome startup ?

ROFL. I suspect I'm right then... it's the delay in establishing an internet connection. I wish I'd known earlier that you turn the modem off each night. Most take a good few minutes to carry out their self-tests then network handshakes to determine the most reliable connection speed. By that time your PC has no doubt already booted to the desktop.

You won't need a batchfile or anything else. If you don't already have one, just create a desktop shortcut to the Pushbullet executable then amend its 'Target' properties by appending -show false like this:



Once you can see in the Notification Area, bottom-right of the taskbar, that you have a connection to the internet, use the desktop shortcut. This will do exactly what you want. It'll start as a background process, check for internet connectivity then display the 'Welcome/Sign in' dialog.

Hope this helps...

RE: How to automate a troublesome startup ?

(OP)
Thank you for that, but I prefer automation, rather than checking for internet, then clicking the desktop shortcut. I should be able to launch the desktop shortcut with a batchfile which has a suitable delay - whatever the size of that is. Provided this really is the solution, I can experiment with delays until I hit the jackpot.

RE: How to automate a troublesome startup ?

Post 5... increase the timeout and add the switch.

For example, 1 minute delay:

CODE --> BAT

TIMEOUT /T 60
START "" "C:\Program Files (x86)\Pushbullet\pushbullet.exe" -show false 

If you don't want to see the commandline console, run the BAT file using the built-in VBS, e.g.:

CODE --> VBS

Set WshShell = CreateObject("WScript.Shell") 
WshShell.Run chr(34) & "C:\data\batch files\dos or cmd\pushbullet.bat" & Chr(34), 0
Set WshShell = Nothing 

Hope this helps...

RE: How to automate a troublesome startup ?

(OP)
Your batch file with a 5 min delay was successfull (for ONE trial without modem restart); I will progressively shorten the delay till it fails to launch, then I will know the required delay.

As for the VBS - it is good to know about, but if it is not NEEDED or superior in achievement, I prefer the more simple, and more easily understood batch file process.

Thank you so much for your patience and forbearance.

RE: How to automate a troublesome startup ?

No problem... hope it works out for you.

PS - The VBS script isn't an alternative to the batch file, just a way to run the batch file invisibly, i.e. without the console window appearing.

RE: How to automate a troublesome startup ?

(OP)
"just a way to run the batch file invisibly" - now you mention it that I see that it in fact calls the batchfile

RE: How to automate a troublesome startup ?

(OP)
PushBullet has been launching reliably - Thank you so much.

I KNOW batchfiles have the extension of 'bat'. Is VBS the typical extension for Powershell script ?

RE: How to automate a troublesome startup ?

Good to hear the outcome.

MyScript.vbs - a Visual Basic Script file.
MyScript.ps1 - a PowerShell script.

Both VBS and PowerShell are built-in to Windows. However, VBS is in 'maintenance mode' with no further development and dwindling support. It's role has been taken over by PowerShell as the primary scripting tool for Windows.

Hope this helps...

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close