Reply to post

how to STOP the HprSnap8 process from command line

Author
aoz
User
  • Total Posts : 305
  • Scores: 0
  • Reward points: 0
  • Joined: 2010/11/22 17:14:33
  • Status: offline
2018/02/10 07:56:32 (permalink)
0

how to STOP the HprSnap8 process from command line

trying to STOP the Hypersnap process from command line.  I then copy my portable stick to that machine, wth hypersnap update.
i then restart hypersnap.
 
I cannot seem to get the Hypersnap to stop, with the following lines
any assistance appreciated
 
-------------------------------
# get HprSnap8 process, see if running, then kill it
$ProgramRunning = Get-Process HprSnap8.exe -ErrorAction SilentlyContinue
if ($ProgramRunning) {
  # try gracefully first
  $ProgramRunning.CloseMainWindow()
  # kill after two seconds
  Sleep 2
  if (!$ProgramRunning.HasExited) {
    $ProgramRunning | Stop-Process -Force
\-------------------------------
 
this SAME set of commands DOES kill KeePass, when it is running, so the mechanism works.  I am missing something, though, with hypersnap process

7 Replies Related Threads

    Admin
    Administrator
    • Total Posts : 275
    • Scores: 6
    • Reward points: 0
    • Joined: 2010/11/22 00:00:00
    • Location: USA
    • Status: offline
    Re: how to STOP the HprSnap8 process from command line 2018/02/10 09:19:19 (permalink)
    0
    I really don't know what the above commands are, from what scripting language etc. I'm not able to help with such advanced topics for languages or scripts I don't know.
    aoz
    User
    • Total Posts : 305
    • Scores: 0
    • Reward points: 0
    • Joined: 2010/11/22 17:14:33
    • Status: offline
    Re: how to STOP the HprSnap8 process from command line 2018/02/10 10:11:05 (permalink)
    0
    sorry, i should have been more concise.
    it is from Powershell, and this looks for running routine, and kills it gracefully
    Main thing is WHAT the process is that is running.
    I checked Task Manager, and it appears that it is "HprSnap8.exe "
    so i set up the script to kill it.  BUT, the icon remains in the task bar, does not seem to be killed (but KeePass, same script, does get killed)
    I have option of HyperSnap to NOT EXIT when I hit the "X" (it reverts to the taskbar), so is something else running that does not let this get killed?
    thanks
     
    Admin
    Administrator
    • Total Posts : 275
    • Scores: 6
    • Reward points: 0
    • Joined: 2010/11/22 00:00:00
    • Location: USA
    • Status: offline
    Re: how to STOP the HprSnap8 process from command line 2018/02/12 07:37:05 (permalink)
    0
    OK, use instead:
     
    $ProgramRunning = Get-Process HprSnap8
    $ProgramRunning.CloseMainWindow()
     
    Above exist completely HyperSnap process regardless of the setting to "not exit when I hit the X button".
     
    Admin
    Administrator
    • Total Posts : 275
    • Scores: 6
    • Reward points: 0
    • Joined: 2010/11/22 00:00:00
    • Location: USA
    • Status: offline
    Re: how to STOP the HprSnap8 process from command line 2018/02/12 11:16:34 (permalink)
    0
    Well, I'm not really PowerShell support. It works fine if HyperSnap window is opened, or minimized normally to the task bar. However if you tell it to hide and show only tray icon, apparently CloseMainWindow() call does nothing, because it considers the main window already closed. However, this seems to work no matter what:
     
    stop-process -Name HprSnap8
    aoz
    User
    • Total Posts : 305
    • Scores: 0
    • Reward points: 0
    • Joined: 2010/11/22 17:14:33
    • Status: offline
    Re: how to STOP the HprSnap8 process from command line 2018/02/12 11:48:02 (permalink)
    0
    GREAT, it worked !!  you don't need to be an expert;  i am in NO WAY an expert;  i've been slowly converting my BAT items to POWERSHELL, and just looking up on internet each type of step i use (such as CHOICE menu, environment variables, etc)
    i just could not figure out what to use to kill the whole process, and your line did it!
    thanks very much.
     
    re: powershell, I've been collecting PDF's of types of actions, to show how to use it;  choice, variables, DO-WHILE, etc.  if you are ever interested, i can give you my whole folder of tutorials and links and examples.
    thanks
    nick
     
    Admin
    Administrator
    • Total Posts : 275
    • Scores: 6
    • Reward points: 0
    • Joined: 2010/11/22 00:00:00
    • Location: USA
    • Status: offline
    Re: how to STOP the HprSnap8 process from command line 2018/02/12 15:18:14 (permalink)
    0
    Thank you, Nick. I still use the old bat files when needed and touch PowerShell very rarely, only if absolutely necessary.
    aoz
    User
    • Total Posts : 305
    • Scores: 0
    • Reward points: 0
    • Joined: 2010/11/22 17:14:33
    • Status: offline
    Re: how to STOP the HprSnap8 process from command line 2018/02/12 16:29:34 (permalink)
    0
    no problem.  but, i'm of tghe same school, i've used BAT files for about 30+ years !!  but since powershell is being pushed more, and has some more features compared to BAT files, i've started to convert my BAT stuff to Powershell stuff.  actually not too hard;  I do google searches on some of the microsoft TechNet sites, for topics, as i noted, that relate to what i was working on, and am usually able to find/(muddle through) how to convert my commands.
    THEN, I keep a template of that command in POwershell, and comment the heck out of it, so I know what steps I did to convert, and what the new nuances are.  that way, when a similar task comes up, i have my own set of worknotes.  Again, you're more than welcome to the tutorials and links i've found, if you ever want to tackle powershell more
    Jump to:
    © 2024 APG vNext Commercial Version 5.1