I have the following function that converts a file to Base64. How do I make it so this function accepts a default value for the file path if one is not entered?
B64 -f $filePath
function B64{
param (
[Parameter (Mandatory = $True, ValueFromPipeline = $True)]
[Alias("file")]
$f
)
$File = "\converted.txt"
$FilePath = ([Environment]::GetFolderPath("Desktop")+$File)
$Content = Get-Content -Path $f
$converted = [convert]::ToBase64String([System.Text.encoding]::Unicode.GetBytes($Content))
$numChar = $converted.length
$incriment = 275
$pre = "STRING powershell -enc "
$string = "STRING "
function splitLines{
While ($converted)
{
$x,$converted = ([char[]]$converted).where({$_},'Split',$incriment)
$x -join ''
}
}