我能用Windows PowerShell做什么:新建一个文件和文件夹
来源:互联网 发布:java上传文件保存路径 编辑:程序博客网 时间:2024/04/28 13:19
注:本篇文章,未在联系作者以及得到许可的情况下, 禁止以任何形式进行转载。
By:Anders Mail:katrina520@163.com
新建一个文件和文件夹
在你的计算机上New-Item 是一个创建新文件和文件夹快而简单的的方法。
举个例子,架设你想在 C:/Scripts 文件夹内建立一个新的目录名为 Windows PowerShell 文件。仅仅只要使用New-Item :
1)新文件夹的完整路径;
2)新的项目类型(其中你可以置顶使用 -type 参数与目录值)。这个命令在问题中看起来像这样:
New-Item c:/scriptsWindows PowerShell -type directory
用同样的步骤创建一个新文件,文件夹,具体完整的路径名称。但是要输入 file。这个命令建立文件 C:/Scripts/New_file.txt :
New-Item c:/scripts ew_file.txt -type file
如果你输入的项目已经被建立存在了,你会得到一个错误的信息,类似这样:
New-Item : The file 'C:/scripts ew_file.txt' already exists.
当然,你可以在包含 -force 参数的情况下来废除这个默认行为:
New-Item c:/scripts ew_file.txt -type file -force
如果你使用 -force 来键入现在有的 New_file.txt 文件将全部更新,为空文件。
说到全部更新,为空文件,你也可以使用 -value 参数来添加一些数据到你的新文件里。这个命令上加上一句,This is text added to the file 的同时建立一个New_file.txt :
New-Item c:/scripts ew_file.txt -type file -force -value "This is text added to the file"
New-Item 别名
- ni
英文原文:http://www.microsoft.com/technet/scriptcenter/topics/msh/cmdlets/new-item.mspx
- 我能用Windows PowerShell做什么:新建一个文件和文件夹
- 我能用Windows PowerShell做什么:新建一个文件和文件夹
- 我能用Windows PowerShell做什么:重命名文件和文件夹
- 我能用Windows PowerShell做什么:复制文件或文件夹
- 我能用Windows PowerShell做什么:删除一个文件或文件夹(或其它输入的目标)
- 我能用Windows PowerShell做什么:核实是否存在的文件或文件夹
- 我能用Windows PowerShell做什么:检索一个特定项目
- 我能用Windows PowerShell做什么:保存 Windows PowerShell 别名
- 我能用Windows PowerShell做什么:暂停 Windows PowerShell 脚本
- 我能用Windows PowerShell做什么:创建一个新的 Windows PowerShell 别名
- 我能用Windows PowerShell做什么:写一个警告讯息到控制台窗口
- 我能用Windows PowerShell做什么:写一个讯息到控制台窗口
- 我能用Windows PowerShell做什么:把数据显示成一个列表
- 我能用Windows PowerShell做什么:执行日期算法
- 我能用Windows PowerShell做什么:执行日期算法
- 我能用Windows PowerShell做什么:检索数字签名
- 我能用Windows PowerShell做什么:列出特殊的成员
- 我能用Windows PowerShell做什么:基本统计计算
- 使用struts+spring+hibernate 组装web应用
- 学习Ogre所以开辟此空间
- eclipse develop for j2me
- CString导致程序异常的问题
- 一步一步学Remoting之一:从简单开始
- 我能用Windows PowerShell做什么:新建一个文件和文件夹
- Vector 还是ArrayList――哪一个更好,为什么?
- Asp.Net EXCEL 导出时COM类工厂80070005和8000401a错误分析及解决办法
- 关于clientHeight、offsetHeight、scrollHeight
- javascript获取按钮的坐标
- 查询某个纪录的所有父类的纪录!
- 关于托管程序退出时候的"code c0020001"错误
- 启动应用程序并向其发送击键 (Visual Basic)
- 一步一步建立基于ARM+Linux的cross toolchain