# Breaking from Sleeping

**URL:** <https://forums.powershell.org/t/breaking-from-sleeping/20750>\
**Category:** PowerShell Help\
**Created:** [October 26, 2022, 7:27pm UTC](https://forums.powershell.org/t/breaking-from-sleeping/20750 "2022-10-26T19:27:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![LiquidMetal](https://avatars.discourse-cdn.com/v4/letter/l/47e85d/32.png) [@LiquidMetal](https://forums.powershell.org/u/LiquidMetal)\
**Post date:** [October 26, 2022, 7:27pm UTC](https://forums.powershell.org/t/breaking-from-sleeping/20750/1 "2022-10-26T19:27:43Z")

</div>

Is there a hot key where I can break from a sleep. After I break from the sleep, is it possible to detect the break from the hot key and do a GOTO to another section of the code?

```auto
Start-Sleep -Seconds $IntervalInSeconds

```

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [October 26, 2022, 8:39pm UTC](https://forums.powershell.org/t/breaking-from-sleeping/20750/2 "2022-10-26T20:39:53Z")

</div>

> [@LiquidMetal](#):
>
> Is there a hot key where I can break from a sleep.

Yes : `<Ctrl>+<c>`

> [@LiquidMetal](#):
>
> After I break from the sleep, is it possible to detect the break from the hot key and do a GOTO to another section of the code?

I’d say “no” … but you may try if this helps:

> [@Clean up before exiting script](https://forums.powershell.org/t/clean-up-before-exiting-script/20605/6):
>
> try - finally, did the trick. try { write-host Starting job. start-job ........ get-content ........ -Tail 100 -Wait } finally { write-host "Removing job, please wait ...." remove-job ......... -Force 2\>$null } When entering ctr-c to exit get-content the job will be removed before the script ends. Just the way I want it. slight_smile

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:16pm UTC](https://forums.powershell.org/t/breaking-from-sleeping/20750/3 "2024-05-16T20:16:27Z")

</div>


