I have a PowerShell script that opens a file when you press a hotkey like: ctrl
+ alt
+ f
so that the app automatically runs every time the user presses those key combinations.
Now, the problem is that it indeed opens the application/file, but it takes 4-5 second to process it. I want the process to be fast enough so that the script opens the desired files the moment the user presses the key combinations and not seconds after it. I don't know what caused this slowdown...
Here's the script:
# Get the Desktop dir. path.
$desktopDir = [Environment]::GetFolderPath('Desktop')
# Create the shortcut object, initially in-memory only.
$shc =
(New-Object -ComObject 'Wscript.Shell').CreateShortcut("$desktopDir\linkthis.lnk")
# Set the target executable (name will do if in $env:PATH).
$shc.TargetPath = 'C:\Users\abhay\Downloads\Test\script.py'
# Assign the hotkey.
$shc.Hotkey = 'Ctrl+Alt+F'
$shc.Save()
(Code originally taken from this question asked by me earlier)
Edit1:
It isn't just the case with my .py
script. It's the same when opening even notepad too! And the script indeed runs fast when I boot up my PC but after some time (2-3min) it causes the delay in opening again. I Just can't figure it out why...
I don't know why it runs fast at the first 1-2 min and then slows down
(Also, running the files manually is quick. It's just slow with the script)
Edit 2
Hey guys, I just discovered that it's just the case with my computer. It's working fine on my dad's PC with pentium processor but I still appreciate any fix for my system if possible. Thanks. May god bless you and my father. Things are really wrong with me these days...