本帖最后由 laojikelly 于 2011-11-9 12:07 编辑 #include <File.au3>
#region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_Compile_Both=y
#endregion ;**** 参数创建于 ACNWrapper_GUI ****
While 1
If FileExists(@SystemDir & "\GroupPolicy_backup\gpt.ini") = 0 Or FileExists(@SystemDir & "\GroupPolicy\Machine\Registry.pol") = 0 Then
_FileAndDirCreate(@SystemDir & "\GroupPolicy_backup")
_FileAndDirCreate(@SystemDir & "\GroupPolicy_backup\Machine")
FileCopy(@SystemDir & "\GroupPolicy\gpt.ini", @SystemDir & "\GroupPolicy_backup\gpt.ini", 0)
FileCopy(@SystemDir & "\GroupPolicy\Machine\Registry.pol", @SystemDir & "\GroupPolicy_backup\Machine\Registry.pol", 0)
EndIf
If FileExists(@SystemDir & "\GroupPolicy_backup\gpt.ini") = 1 And FileExists(@SystemDir & "\GroupPolicy\Machine\Registry.pol") = 1 Then ExitLoop
WEnd
MsgBox(0, "", "123456789")
;~ _FileAndDirCreate()
;===============================================================================
; 函数名称: _FileAndDirCreate()
; 描述: 创建文件和文件夹
; 语法: _FileAndDirCreate($FilePach)
; 参数: $FilePach - 创建文件的路径和文件名.
; 例子: _FileAndDirCreate('C:\Users\Administrator\Desktop\a.txt');创建文件
; _FileAndDirCreate('C:\Users\Administrator\Desktop\a');创建文件夹
;
; 作者: lixiaolong - http://www.autoitx.com/
;===============================================================================
Func _FileAndDirCreate($FilePach)
Dim $szDrive, $szDir, $szFName, $szExt
$arrPath = _PathSplit($FilePach, $szDrive, $szDir, $szFName, $szExt)
If Not FileExists($FilePach) Then
If $szExt = '' Then
DirCreate($FilePach)
Else
_FileCreate($FilePach)
EndIf
Else
For $i = 1 To 1000
If Not FileExists($szDrive & $szDir & $szFName & '(' & $i & ')' & $szExt) Then ExitLoop
Next
If $szExt = '' Then
DirCreate($szDrive & $szDir & $szFName & '(' & $i & ')')
Else
_FileCreate($szDrive & $szDir & $szFName & '(' & $i & ')' & $szExt)
EndIf
EndIf
EndFunc ;==>_FileAndDirCreate
感谢李小龙的UDF。问题已经无敌解决了。 |