Basics of Input and Output in Windows PowerShell

Configurare noua (How To)

Situatie

Windows PowerShell is a command-line and scripting language designed for system administration. It helps IT professionals, to control and automate the administration of the Windows Operating System and Windows Server Environment. There are cmdlet for console input and output using PowerShell.

Solutie

Example : Showing the Output to console

Function to print a string.
Input : 'AskIT' 
Output : Hello AskIT

Input : 'PowerShell Beginner'
Output : Hello PowerShell Beginner

# show function definition
function show {

param ( $str2 )
#parameter string

Write-Host “Hello $str2”
# output on console

}

$str = “AskIT”
# string declaration

show ( $str )
#function call with string

Note: If your script show error “script is Disabled” while running program then try to change the execution policy with administrative privilege by using the command ‘set-executionpolicy remotesigned‘.

Tip solutie

Permanent

Voteaza

(5 din 12 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?