Okido, here’s my first powershell script (or command line).

The action I want to accomplish is to copy a file to another directory.
I installed powershell v2 on my machine.

To open the powershell prompt you can do next steps:

  • give ‘windows key + r’ (opens ‘Start=>Run’)
  • give ‘powershell’ without the quotes
  • the powershell prompt now opens

When you want to change the working directory give cd followed by the full path, for example ‘cd c:\temp’ (without quotes).

After changing the working directory it is time for action.
In ‘c:\temp’ I created a file named ‘test.txt’ and a directory called ‘c:\temp\test’.
The powershell command to copy ‘test.txt’ to the ‘test’ directory is:


copy-item c:\temp\test.txt c:\temp\test

The result is that the file test.txt is copied to c:\temp\test\test.txt.
Instead of using copy-item you can also use the aliases ‘cp’ or ‘cpi’.

Happy scripting.

Best regards,

Dirk Adamsky – Deludi BV

VN:F [1.9.3_1094]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.3_1094]
Rating: 0 (from 0 votes)
© 2010 Dirk Adamsky Scripting Blog Suffusion WordPress theme by Sayontan Sinha