beginner copy

This topic contains 4 replies, has 3 voices, and was last updated by  Matt Bloomfield 2 years ago.

  • Author
    Posts
  • #32288

    Fred Robinson
    Participant

    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.

  • #32292

    Matt Bloomfield
    Participant

    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

    Get-Help *copy*

    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.

  • #32306

    Bob McCoy
    Participant

    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.

  • #32318

    Fred Robinson
    Participant

    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?

  • #32320

    Matt Bloomfield
    Participant

    Do you have read permissions on the file in its new location? Can you browse to it and open it in notepad?

You must be logged in to reply to this topic.