 
  
   использовать правильное событие - для радио это
использовать правильное событие - для радио это$r1.Add_CheckedChanged({
param(
  [Object]$sender,
  [System.EventArgs]$e
)
  if ($r1.Checked -eq $true) {
    $c.Visible = $true
} else { 
    $c.Visible = $false
}
}) 
  
  ErrorAction SilentlyContinue не спрячет при выполнение invoke-webrequest или invoke-restmethod  И приходитсяtry {
    $ProgressPreference = 'Stop'
     $response  = Invoke-WebRequest -uri $url   
    $ProgressPreference = 'Continue'
  } catch [Exception]{
    # 1 NameResolutionFailure  
    # 15 ProxyNameResolutionFailure	
    # 2 ConnectFailure
    # 3 ReceiveFailure
    # 7 ProtocolError
    # 9 TrustFailure
    if ( $exception.Status -ne 7 ) {
      $statuscode =  $exception.Status
    } else { 
      $statuscode = $exception_statuscode.value__
    } 
  
   
  
  @echo off
REM для https://qna.habr.com/q/1027240
set C=%~nx0
if NOT "%DEBUG%" equ "" echo Running with DEBUG set
REM using two environment parameters: C and DEBUG
REM NOTE:  passing arguments appears tricky when
REM powershell run with command built inline as string
@powershell.exe -ExecutionPolicy Bypass -Command "$debug=$env:DEBUG;$s=(get-content \"%~f0\") -join \"`n\"; $s = $s.substring($s.IndexOf(\"goto :\"+\"EOF\")+9);if ($debug -ne $null){write-output (\"Running:`n{0}\" -f$s);} invoke-expression -command $s"
@goto :EOF
# powershell code
start-sleep 5
write-output ( 'Calling script: {0}' -f $env:C)
pause
exit 0c:\Users\sergueik\Desktop>set debug=1
c:\Users\sergueik\Desktop>show_caller.cmd
Running with DEBUG set
Running:
Start-Sleep 5
write-output ( 'Calling script: {0}' -f $env:C)
pause
exit 0Calling script: show_caller.cmd
Press Enter to continue...: 
  
   
  
  Desktop\test.ps1:write-output 'test'test.py:# -*- coding: iso-8859-1 -*-
import subprocess, sys
p = subprocess.Popen(["powershell.exe",
              "C:\\Users\\<USER>\\Desktop\\test.ps1"],
              stdout=sys.stdout)
p.communicate()python test.pytest       
  
   
  
  $d = 'eclipse'; get-childitem -path $d -attributes directory  | foreach-object { $target  = $_.FullName; &  echo icacls $target /restore acl /t /c  }echo уберите и $d сделайте = 'D:\Project'       
  
   
  
  remove-item -path 'not existing.txt' -erroraction silentlycontinue; echo $?
False
new-item -path 'dummy.txt'
Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----       11/17/2019   8:24 PM              0 dummy.txt
remove-item -path 'dummy.txt' -erroraction silentlycontinue; echo $?
True 
  
   
  
  $func = { param ($a, $b)  ('{0} {1}' -f $a , $b)}
[Linq.Enumerable]::Zip(@("D:\1", "D:\2","D:\3"), @("C:\1", "C:\2", "C:\3"), [Func[Object, Object, Object[]]]$func)D:\1 C:\1
D:\2 C:\2
D:\3 C:\3