Skip to content

yuravg/windows-scripts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

windows-scripts

My scripts for Windows OS

Usage:

  1. Copy script/scripts from bin directory to c:/Windows (or other PATH directory)
  2. Press Windows+R to open the “Run” box. Type <script_name> into the box(press Ctrl+Shift+Enter to run the script as an administrator).

Directory templates has some templates of scripts.

Directory regedit has scripts to configuration Windows registry.

bin

ConEmu

@echo off
rem
rem Launch ConEmu installation directory
rem
@echo on
start "" "C:\Program Files\ConEmu\ConEmu64.exe"

PDFXCview (pdfx)

@echo off
rem
rem Launch PDFXCview from installation directory
rem
@echo on
start "" "C:\Program Files\Tracker Software\PDF Viewer\PDFXCview.exe"

Acrobat reader

@echo off
rem
rem Launch Acrobat Reader from installatoin directory
rem
@echo on
start "" "c:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe"

Shutdown

@echo off
rem
rem Shutdown Windows OS
rem
@echo on
shutdown /s /t 0

Reboot

@echo off
rem
rem Reboot Windows OS
rem
@echo on
shutdown /r /t 5

Git-bash

@echo off
rem
rem Launch Git-bash.exe from installation directory
rem
@echo on
start "" "C:\Git\git-bash.exe"

MinGW

@echo off
rem
rem Launch mingw64.exe from installation directory
rem
@echo on
start "" "c:\msys64\mingw64.exe"

Jupyter Console

@echo off
rem
rem Jupyter Console
rem
@echo on
start "" "c:\Python38\Scripts\jupyter-console.exe"

Jupyter Console

@echo off
rem
rem Jupyter QtConsole
rem
@echo on
start "" "jupyter-qtconsole.exe"

Develop-mode

Enable Develop-mode

@echo off
rem
rem Enable Loading of Test Signed Drivers
rem
rem https://docs.microsoft.com/en-us/windows-hardware/drivers/install/the-testsigning-boot-configuration-option
rem
rem Administrator rights required:
rem  Press Windows+R to open the "Run" box. Type "cmd" into the box and then press
rem  Ctrl+Shift+Enter to run the command as an administrator.

echo ***** ENABLE Loading of Test Signed Drivers *****
echo NOTE: Administrator rights required!
echo        (press Windows+R to open the "Run" box;
echo         Ctrl+Shift+Enter to run the command as an administrator)
@echo on

bcdedit /set testsigning on
pause

Disable Develop-mode

@echo off
rem
rem Disable of Test Signed Drivers
rem
rem https://docs.microsoft.com/en-us/windows-hardware/drivers/install/the-testsigning-boot-configuration-option
rem
rem Administrator rights required:
rem  Press Windows+R to open the "Run" box. Type "cmd" into the box and then press
rem  Ctrl+Shift+Enter to run the command as an administrator.

echo ***** DISABLE Loading of Test Signed Drivers *****
echo NOTE: Administrator rights required!
echo        (press Windows+R to open the "Run" box;
echo         Ctrl+Shift+Enter to run the command as an administrator)
@echo on

bcdedit /set testsigning off
pause

Wish message

@echo off
rem
rem Run: wish(Tcl/Tk Simple windowing shell) message window
rem      https://github.com/yuravg/eda-scripts/blob/master/bin/wish_cmd
rem
@echo on
wish %HOME%\projects\eda-scripts\bin\wish_msg %*

templates

device enable

#!/usr/bin/env powershell

#
# <DeviceName> Enable
#
# https://www.reddit.com/r/PowerShell/comments/5j4djb/disabling_devices_from_powershell_scripts_in/
#

$device_name = "<DeviceName>"

Write-Host "***** '$device_name' ENABLE ***** `n" -ForegroundColor Green

# Escalate privileges if not admin
If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
{
    $arguments = "& '" + $myinvocation.mycommand.definition + "'"
    Start-Process powershell -Verb runAs -ArgumentList $arguments
    Break
}

# Loop through them to disable/enable one at a time to lessen the possibility no conrolling
# devices are available to confirm But might want to do this remotely to be sure.
Get-PnpDevice |
  Where-Object { $_.FriendlyName -match $device_name } |
  Enable-PnpDevice -Confirm:$false

device disable

#!/usr/bin/env powershell

#
# <DeviceName> Disable
#
# https://www.reddit.com/r/PowerShell/comments/5j4djb/disabling_devices_from_powershell_scripts_in/
#

$device_name = "<DeviceName>"

Write-Host "***** '$device_name' DISABLE ***** `n" -ForegroundColor Blue

# Escalate privileges if not admin
If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
{
    $arguments = "& '" + $myinvocation.mycommand.definition + "'"
    Start-Process powershell -Verb runAs -ArgumentList $arguments
    Break
}

# Loop through them to disable/enable one at a time to lessen the possibility no conrolling
# devices are available to confirm But might want to do this remotely to be sure.
Get-PnpDevice |
  Where-Object { $_.FriendlyName -match $device_name } |
  Disable-PnpDevice -Confirm:$false

device status

#!/usr/bin/env powershell

#
# <DeviceName> Status
#

$device_name = "<DeviceName>"

Get-WmiObject Win32_PNPEntity | Where-Object{$_.ConfigManagerErrorCode -eq 0} | Where-object{$_.Name -Match $device_name} | Select Name, DeviceID

Windows registry configurations

regedit/Add_Open_Bash_window_here_context_menu.reg – Add ‘Open Bash window here’ context menu in Windows 10

Drivers

Windows PnPUtil tool

pnputil-examples

# List devices
pnputil /enum-devices
# Remove drivers
pnputil /delete-driver <driver-name> /force

About

My scripts for Windows OS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published