1. Is there a command line bash's !$ (match last word of previous command)

  2. any shortcut to delete previous word. Ex: cd D:\programs\scrap .<ctrl+backspace> deletes the word 'scrap'

  3. Replace <br> tags with newlines in the output. I tried this:

    PS D:\program files\wamp\www\play> p .\delete.php | Foreach-Object {$_ -replace "<br>", "\n"}

    1310210455\n13101240552218 //OUTPUT

which does replace the
with \n , but it doesn't create a newline.just a plain text \n. Fix?

  1. cd d:\pro completes the directory name , but doesn't add a . Why? possible at all to fix it?

Thats all for now. powershell is really working for me now. Thanks

link|improve this question

75% accept rate
feedback

1 Answer

up vote 3 down vote accepted

1) $$ will match the last token of the previous command. E.g.:

C:\PS> cd 'C:\Program Files'
C:\Program Files>$$
C:\Program Files
C:\Program Files>

2) <ctrl+backspace> will delete the previous word if you are using the PowerShell ISE, but the Windows console does not support deleting a previous word. You can run the ISE with the script pane hidden so there is only a command pane and output pane.

3) To put a newline in a string use `n. For your example:

PS D:\program files\wamp\www\play> p .\delete.php | Foreach-Object {$_ -replace "<br>", "`n"}

4) I'm not sure what your last question is. You say "but doesn't add a ." Is there something missing between the 'a' and the '.'? I'm assuming it's a '\'. If it is, you can add a backslash after the quote and continue to tab-complete. PowerShell will move the quote next time you tab. E.g.

cd c:\pro<tab> yields -> cd 'C:\Program Files' then,

cd 'C:\Program Files'\mic<tab> yields -> cd 'C:\Program Files\Microsoft'

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.