What is the PowerShell equivalent of bash's exec()? What is the PowerShell equivalent of bash's exec()? windows windows

What is the PowerShell equivalent of bash's exec()?


You can also use .\Script.ps1

Or start typing the name and use TAB to complete the script name.

Dot-sourcing a script allows a function to become available on the command line.

For example:

Function Get-LocalTime { $CurTime = Get-Date"The Date and time currently is $CurTime"}

Now we dot source (name the above script Example.ps1) PS C:\>. .\Example.ps1

Allowing us to simply type and Tab complete Get-LocalTime

http://i.imgur.com/17xfn6L.png

-edit to comment, you can define a function and use the function immediately in the same script. So in Example.ps1, at the last line just enter Get-LocalTime