Answers for "Script to detect and clone display"

1

Script to detect and clone display

function Set-Display
{
    param(
        [Parameter(Position=0)]
        [ValidateSet('external','internal','clone','extend','gui')]
        [string]$Mode='gui'
    )
    
    $path = Join-Path -Path ([environment]::SystemDirectory) -ChildPath DisplaySwitch.exe
    
    if( !(Test-Path -Path $path -PathType Leaf))
    {
        throw "Cannot find DisplaySwitch.exe"
    }
    
    
    if($Mode -eq 'gui')
    {
        & $path
    }
    else
    {
        & $path /$Mode
    }
}

PS > Set-Display -Mode clone
Posted by: Guest on July-29-2020

Code answers related to "Script to detect and clone display"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language