My scripts for Windows OS
Usage:
- Copy script/scripts from
bin
directory toc:/Windows
(or otherPATH
directory) - Press
Windows+R
to open the “Run” box. Type<script_name>
into the box(pressCtrl+Shift+Enter
to run the script as an administrator).
Directory templates
has some templates of scripts.
Directory regedit
has scripts to configuration Windows registry.
@echo off
rem
rem Launch ConEmu installation directory
rem
@echo on
start "" "C:\Program Files\ConEmu\ConEmu64.exe"
@echo off
rem
rem Launch PDFXCview from installation directory
rem
@echo on
start "" "C:\Program Files\Tracker Software\PDF Viewer\PDFXCview.exe"
@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"
@echo off
rem
rem Shutdown Windows OS
rem
@echo on
shutdown /s /t 0
@echo off
rem
rem Reboot Windows OS
rem
@echo on
shutdown /r /t 5
@echo off
rem
rem Launch Git-bash.exe from installation directory
rem
@echo on
start "" "C:\Git\git-bash.exe"
@echo off
rem
rem Launch mingw64.exe from installation directory
rem
@echo on
start "" "c:\msys64\mingw64.exe"
@echo off
rem
rem Jupyter Console
rem
@echo on
start "" "c:\Python38\Scripts\jupyter-console.exe"
@echo off
rem
rem Jupyter QtConsole
rem
@echo on
start "" "jupyter-qtconsole.exe"
@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
@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
@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 %*
#!/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
#!/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
#!/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
regedit/Add_Open_Bash_window_here_context_menu.reg – Add ‘Open Bash window here’ context menu in Windows 10
# List devices
pnputil /enum-devices
# Remove drivers
pnputil /delete-driver <driver-name> /force