append usingtext的using指令是什么

Android中 setText()和append()方法区别在哪里?_百度知道Categories
A sample text widget
Etiam pulvinar consectetur dolor sed malesuada. Ut convallis
pretium. Nunc ut tristique massa.
Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan.
Morbi orci magna, tincidunt vitae molestie nec, molestie at mi. Nulla nulla lorem,
suscipit in posuere in, interdum non magna.
By Gerardo Lopez, on August 23rd, 2009
Here’s a quick tutorial on how to add text to the end of a text file using the Add-Content or its alias ac in PowerShell. In this first example let’s add &This is the last line& to the end of a file.
Add-Content c:\sample.txt &This is the last line&
The example above adds the text to the last line, it doesn’t actually create a new line, so let’s try it again, and make sure that this time the text that we concatenate is on the last line all by itself.
Add-Content c:\sample.txt &`r`nThis is the last line&
You’ll notice a `r`n this is an escape character to tell PowerShell to add a carriage return and a new line, you’ll need this when working with Windows file.
If your going to move this file to a unix or linux computer, you’ll only need a `n there’s no need for the carriage return.
Here is a list of escape characters:
— Null
— Alert
`b — Backspace
`n — New line
`r — Carriage return
`t — Horizontal tab
`’ — Single quote
`” — Double quote
The example I gave above was the quick and dirty, we should really explicitly state our arguments and use quotes around the path, to do that we will add a path and a value argument
Add-Content -Path &c:\sample.txt& -Value &`r`nThis is the last line&
Here’s a useful example, suppose you want to map hostname to a particular IP address.
Let’s
to point to 127.0.0.1, we’ll do this using the ac alias for Add-Content.
ac -Path &C:\WINDOWS\system32\drivers\etc\hosts& -Value &`r`n127.0.0.1
Recent Posts

我要回帖

更多关于 append using 的文章

 

随机推荐