Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have cp for power shell. But I want to use cp in verbose mode without writing -v. So cp should be aliased to "cp -v" command. How to alias cp to "cp -v" in power shell?

share|improve this question
    
What are you really trying to do? – kinokijuf Aug 28 '12 at 16:12
    
I have cp for power shell. But I want to use cp in verbose mode without writing -v. So cp should be aliased to "cp -v" command. – Narek Aug 28 '12 at 16:18
up vote 2 down vote accepted

The alias command will not create parameters. You'll have to delete the existing alias for cp and use a function:

Remove-Item alias:cp
Function cp { Copy-Item -v @args }

See here.

share|improve this answer
    
THanks a lot!!!! – Narek Aug 29 '12 at 11:49

Create a new alias for calling cp with the Verbose flag:

function Copy-ItemWithVerbose
{
    Copy-Item -Verbose @args 
}
Set-Alias -Name cpv -Value Copy-ItemWithVerbose
share|improve this answer

in PS3 you can use this:

PS III> $PSDefaultParameterValues.Add("Copy-item:verbose","$true")
PS III> cp
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .