This topic contains 4 replies, has 3 voices, and was last updated by
November 26, 2015 at 1:11 am #32288ParticipantPoints: 0Rank: Member
So I am a total beginner in programming. How do I use powershell to copy a file from the desktop to another directory? I dont understand where the working directory is supposed to be, is it at the receiving end or what? I want to move a file from one directory to another without them necessarily being siblings, so to speak. Excuse the confused question that reflects my confused mind.
November 26, 2015 at 2:06 am #32292ParticipantPoints: 0Rank: Member
Forgive me, I'm not going to tell you how to do it.
What I will do is show you how you can find out how to do it. PowerShell has a powerful help system which allows you to discover commands (which PowerShell calls cmdlets) and how to use them. A good starting point for you would be the command
This will search the help files for all references to 'copy'. From those results, you should be able to work out which command you can use to copy items (that's a hint!) from one location to another. PowerShell provides examples of how to use the commands and you can see those with
Get-Help Cmdlet-Name -Examples
Let us know how you get on.
November 26, 2015 at 6:36 am #32306ParticipantPoints: 0Rank: Member
Matt's right in this respect, it's not at all a complicated process. But you really should learn the tools that are going to consistently help you on your PowerShell journey. Get-Help and Get-Member will be your best friends on this path. Then there's always Bing and Google.
November 27, 2015 at 5:36 am #32318ParticipantPoints: 0Rank: Member
Thanks for......hmm. Ok, so I used the copy-item command:
copy-item -path -destination and it seems that I managed to copy the file. However when I want tolook at this textfile with teh command more I am denied access.
What say you?
November 27, 2015 at 7:09 am #32320ParticipantPoints: 0Rank: Member
Do you have read permissions on the file in its new location? Can you browse to it and open it in notepad?
The topic ‘beginner copy’ is closed to new replies.