PowerShell script named **C:\Scripts\Greetings.ps1

Hello,
you can give him guidance on what exactly you need to do here

Create a PowerShell script named C:\Scripts\Greetings.ps1 that when executed asks the user for his/her name and then stores ( appends ) it in a file C:\Temp\Names.txt

Your next homework project? :wink: It’s the same like with your other request. We do not write ready to use code on request. Why don’t you start writing some code and when you get stuck you post your code and what is not working as desired and we can try to help you further? You do not learn something when you always let others do your job. :wink:

BTW: There are more than enough code examples for tasks like this out there. 99% of the time you’re not the first one with a given tasks. So there is a big chance to find something almost fitting you can adapt to your particular requirements with little to no effort from yourself. :wink: :wink:

To get you actually started with PowerShell you may start learning the very basics of PowerShell first. A good start is still the video series from the inventor of PowerShell - Jeffrey Snover:

https://channel9.msdn.com/Series/GetStartedPowerShell3

Don’t worry if it’s not about the current version of PowerShell - the basics are still the same. :+1:

3 Likes

Hi, this time it was for an exam.
I tried and wrote the following. I don’t know if it meets the condition.
We will understand these days.
I will also look at the link you gave me.
Thanks ! Have a nice day!

$User = Read-host -Prompt 'Input the user name' | Out-File C:\Temp\Names.txt

The easiest way to check if the code does what you want is to run it. :wink: Does the code do what is required?
You may (re-)read the help for the cmdlet you want to use:

You should read the help completely including the examples to learn how to use it. :+1: