added script to boot windows

This commit is contained in:
2025-06-08 14:22:17 +10:00
parent d4a37b723f
commit b7f1abf9b2
2 changed files with 18 additions and 4 deletions

14
.local/bin/bootwindows Executable file
View File

@@ -0,0 +1,14 @@
#!/usr/bin/env bash
win_bootnum=$(efibootmgr | grep -i "windows boot manager" | awk '{print $1}' | sed 's/Boot//;s/\*//')
if [[ -z "$win_bootnum" ]]; then
echo "Windows Boot Manager not found in UEFI boot entries."
exit 1
fi
echo "Setting Windows Boot Manager (Boot$win_bootnum) as next boot"
sudo efibootmgr -n "$win_bootnum"
if [[ $? -ne 0 ]]; then
echo "Failed to set BootNext"
exit 1
fi
echo "Rebooting now..."
reboot

View File

@@ -5,9 +5,9 @@ PROJECTS_DIR="$HOME/projects"
# Function to print usage
print_usage() {
echo "Usage: $0 [-n] <project_name>"
echo "Usage: $0 [-c] <project_name>"
echo "Options:"
echo " -n Create a new project directory if it does not exist"
echo " -c Create a new project directory if it does not exist"
}
# Check if at least one argument is provided
@@ -21,9 +21,9 @@ CREATE_NEW=false
PROJECT_NAME=""
# Parse options
while getopts ":n" opt; do
while getopts ":c" opt; do
case $opt in
n)
c)
CREATE_NEW=true
;;
\?)