Windows Tips
Run apps in Admin Mode
Run BAT files with Admin Privileges
At the top your bat
file, add the following:
It will elevate to admin and also stay in the correct directory.
If you want to kill the prompt after execution, you can add exit
at the end of your bat
file. Source
Store Powershell output
There might be times where you want to run a powershell command, and store it's output to be used in another script. You can use the Out-File parameter to store the output in a text file. For example, to store whether BIOS Virtualization is enabled or disabled in a system
The command out will be saved in the filepath mentioned (here: C:\users<username>\virtualization.txt as $HOME is expanded automatically)
Disabling Cursor Blink
In apps such as command promt, inside which you can open programs such as nvim, you will see a blinking cursor. If you are like me, you don't really want the cursor to blink, it is visible on it's own. To disable cursor blink,
- Go to Run prompt (
Win+R
) -
Paste this in the prompt:
- Press Enter/Ok to open the Keyboard Properties Dialogbox
- Set cursor blink rate to None in the slider
- Select Ok and the cursor will stop blinking.
Note: In gVim, you can disable cursor blinking via adding the following in your .vimrc
Enable/Disable BlueTooth using Command Line
If you are like me and live inside the terminal, your taskbar will always be hidden. It is therefore a pain when you have to enabe/disable bluetooth. For that, you can use this powershell script below:
Store this file as bl.ps1
Now, you can call it from within powershell or command prompt. To enable Bluetooth
To disable Bluetooth
To simplify the process even further, you can store the path of this file in path so you can access it from anywhere. Moreover, you can create batch scripts for both the scenarios, and add these batch scripts to path as well.
Change PowerShell Theme to Dracula
Note: Run all the commands in an elevated session of PowerShell (i.e. Admin mode)
-
First, we need the
PowerShellGet
utility -
Open new instance of PowerShell to get the
-AllowPrerelease
flag: -
Open new instance of PowerShell to install the
PSReadLine
latest release: - Download and Extract ColorTool
-
Change Directory to the extracted path
-
Run the installation script
-
Open your PowerShell profile and add the following to it
- All subsequent PowerShell sessions will have the dracula theme applied to them