AutoHotKey使用教程

This line is indented with a tab; by default, that tab will also be written to the file.

Variable references such as %Var% are expanded by default. ), C:\\My File.txt

; The following example demonstrates how to automate FTP uploading using the operating

; system's built-in FTP command. This script has been tested on Windows XP and 98se.

FTPCommandFile = %A_ScriptDir%\\FTPCommands.txt FTPLogFile = %A_ScriptDir%\\FTPLog.txt

FileDelete %FTPCommandFile% ; In case previous run was terminated prematurely.

FileAppend, (

open host.domain.com username password binary cd htdocs

put %VarContainingNameOfTargetFile% delete SomeOtherFile.htm

rename OldFileName.htm NewFileName.htm ls -l quit

), %FTPCommandFile%

RunWait %comspec% /c ftp.exe -s:\FileDelete %FTPCommandFile% ; Delete for security reasons. Run %FTPLogFile% ; Display the log for review.

FileCopy函数用来拷贝一个或多个文件。函数格式如下: FileCopy, SourcePattern, DestPattern [, Flag]

SourcePattern 源文件或文件夹的名称或匹配符,如:C:\\Temp\\*.tmp。如果没有给出绝对路径,默认源文件在%A_WorkingDir%文件夹中 DestPattern 目的文件或文件夹的名称或匹配符,如果没有给出绝对路径,默认目的文件在%A_WorkingDir%文件夹中 Flag 用来决定如果文件存在,是否覆盖。默认是0,不覆盖,1覆盖。 请看下面的例子:

FileCopy, C:\\My Documents\\List1.txt, D:\\Main Backup\\ ; Make a copy but keep the orig. file name.

FileCopy, C:\\My File.txt, C:\\My File New.txt ; Copy a file into the same folder by providing a new name.

FileCopy, C:\\Folder1\\*.txt, D:\\New Folder\\*.bkp ; Copy to new location and give new extension.

FileCopyDir函数用来拷贝一个文件夹内的所有内容。函数个数如下: FileCopyDir, Source, Dest [, Flag] Source 源文件夹的名称,如:C:\\Temp。如果没有给出绝对路径,默认源文件夹在%A_WorkingDir%文件夹中 Dest 目的文件夹的名称,如果没有给出绝对路径,默认目的文件夹在%A_WorkingDir%文件夹中 Flag 用来决定如果文件存在,是否覆盖。默认是0,不覆盖,1覆盖。 请看下面的例子:

FileCopyDir, C:\\My Folder, C:\\Copy of My Folder

; Example #2: A working script that prompts you to copy a folder. FileSelectFolder, SourceFolder, , 3, Select the folder to copy if SourceFolder = return

; Otherwise, continue.

FileSelectFolder, TargetFolder, , 3, Select the folder IN WHICH to create the duplicate folder. if TargetFolder = return

; Otherwise, continue.

MsgBox, 4, , A copy of the folder \\IfMsgBox, No return

SplitPath, SourceFolder, SourceFolderName ; Extract only the folder name from its full path.

FileCopyDir, %SourceFolder%, %TargetFolder%\\%SourceFolderName% if ErrorLevel

MsgBox The folder could not be copied, perhaps because a folder of that name already exists in \return

联系客服:779662525#qq.com(#替换为@) 苏ICP备20003344号-4