I have a problem and I cannot find a solution online.
I have the following code, and I would like to read two inputs and save them in a text file. When the user puts his email and API token, it creates a text file and separates his input in two lines. I don't know what to use with the Read-Host.
For example:
[email protected]
123456789abcdefg
What I would like to do is to use his input, but have a default name in front of each line such as:
Email = [email protected]
APIToken = 123456789abcdefg
Here is my code:
Write-Host 'Enter your email: '
Read-Host | Out-File $CredsFile
Write-Host 'Enter your API Token: '
Read-Host | Out-File $CredsFile -Append
$CredsFile = $CredsFile -join [Environment]::NewLine
$configuration = ConvertFrom-StringData($CredsFile)
$email = $configuration.'Email'
$api_token = $configuration.'APIToken'