/zh-cn/docs/commands/FileDelete.htm
https://github.com/wyagd001/wyagd001.github.io · HTML · 44 lines · 36 code · 8 blank · 0 comment · 0 complexity · ced820fa920eb6ef4ff67176e39169e9 MD5 · raw file
- <!DOCTYPE HTML>
- <html>
- <head>
- <title>FileDelete | AutoHotkey</title>
- <meta name="description" content="The FileDelete command deletes one or more files." />
- <meta http-equiv="content-type" content="text/html; charset=utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <link href="../static/theme.css" rel="stylesheet" type="text/css" />
- <script src="../static/content.js" type="text/javascript"></script>
- <script type="text/javascript">$(function(){0<=window.navigator.userAgent.toLowerCase().indexOf("ucbrowser")&&CaoNiMaDeUc()})</script>
- </head>
- <body>
- <h1>FileDelete</h1>
- <p>删除一个或多个文件.</p>
- <pre class="Syntax"><span class="func">FileDelete</span>, FilePattern</pre>
- <h2 id="Parameters">参数</h2>
- <dl>
- <dt>FilePattern</dt>
- <dd><p>单个文件的名称或通配符模式, 例如 <code>C:\Temp\*.tmp</code>. 如果未指定绝对路径, 则假定 <em>FilePattern</em> 在 <a href="../Variables.htm#WorkingDir">%A_WorkingDir%</a>.</p>
- <p>要删除整个文件夹及其所有子文件夹和文件, 请使用 <a href="FileRemoveDir.htm">FileRemoveDir</a>.</p></dd>
- </dl>
- <h2 id="Error_Handling">错误处理</h2>
- <p><span class="ver">[v1.1.04+]</span>: 此命令失败时会抛出异常. 想了解更多信息, 请参阅<a href="Catch.htm#RuntimeErrors">运行时错误</a>.</p>
- <p><a href="../misc/ErrorLevel.htm">ErrorLevel</a> 被设置为删除失败的文件数, 否则为 0. 删除像 <code>*.tmp</code> 这样的通配符模式即使它不匹配任何文件也被视为是成功的; 因此 ErrorLevel 被置为 0.</p>
- <p>如果找到了文件, 则 <a href="../Variables.htm#LastError">A_LastError</a> 会被设置为 0(零) 或最近一次操作失败时调用操作系统 GetLastError() 函数的结果. 否则 A_LastError 包含了没有找到文件原因的错误码.</p>
- <h2 id="Remarks">备注</h2>
- <p>要删除只读文件, 请首先移除它的只读属性. 例如: <code><a href="FileSetAttrib.htm">FileSetAttrib</a>, -R, C:\My File.txt</code>.</p>
- <h2 id="Related">相关</h2>
- <p><a href="FileRecycle.htm">FileRecycle</a>, <a href="FileRemoveDir.htm">FileRemoveDir</a>, <a href="FileCopy.htm">FileCopy</a>, <a href="FileMove.htm">FileMove</a></p>
- <h2 id="Examples">示例</h2>
- <div class="ex" id="ExBasic">
- <p><a class="ex_number" href="#ExBasic"></a> 删除目录中的所有 .tmp 文件.</p>
- <pre>FileDelete, C:\temp files\*.tmp</pre>
- </div>
- </body>
- </html>