Search notes:

Powershell module: psHelpers

Functions

get-textFromInput Returns a text. If the parameter is clipboard, it returns the content of the clipboard. If it is a path of a file, it returns the file's content. Otherwise, it returns the value of the parameter itself.

Source code

psHelpers.psm1

set-strictMode -version 3

function get-textFromInput {

   param (
      [string] $param
   )

   if ($param -eq 'clipboard') {
      return get-clipboard
   }

   $param_ = $param -replace '^\w:', '' # remove leading C: etc. because the colon is an illegal character

 # Check if $param_ contains characters that are illegal in NTFS:
   if ( $param_ -ne '/' -and $param_ -notMatch '[?\*:<>|"\n]') {

       if (test-path -pathType leaf -literalPath $param) {
          return get-content -raw $param
       }
   }

   return $param
}
Github repository ps-module-psHelpers, path: /psHelpers.psm1

psHelpers.psd1

@{
   rootModule         = 'psHelpers.psm1'
   moduleVersion      = '2026.09.30'

   author             = 'René Nyffenegger'
   description        = 'Uncategorized utility functions'

   functionsToExport  = @(
     'get-textFromInput'
   )
                                  
   guid               = '52656e65-7073-4865-6C70-657273729af3'
}
Github repository ps-module-psHelpers, path: /psHelpers.psd1

See also

The module's github repository
Other simple powershell modules I've written.

Index