求助:注册当前目录下的ocx文件
大家好,请帮忙看看用批处理命令能用AU3完成吗?
For %%a in (*.ocx) do regsvr32.exe /s %%a 去看_RunDOS Dim $FileList
$FileList = _Find(@ScriptDir, "Ocx", $FileList)
For $i = 1 To $FileList
;MsgBox(0, "", $FileList[$i])
RunWait("regsvr32.exe /s "&$FileList[$i])
Next
Func _Find($nPath, $nType, ByRef $sFileList, $nFlag = 1)
If StringRight($nPath, 1) = "\" Then $nPath = StringTrimRight($nPath, 1)
If StringLeft($nType, 1) = "." Then $nType = StringTrimLeft($nType, 1)
Local $nSearch = FileFindFirstFile($nPath & "\*.*")
If $nSearch = -1 Then Return SetError(0)
If @error = 1 Then Return SetError(1, 1, "")
While 1
$nFile = FileFindNextFile($nSearch)
If @error Then ExitLoop
If StringRegExpReplace($nFile, '.+\.', '') = $nType Then
$sFileList += 1
If UBound($sFileList) <= $sFileList Then ReDim $sFileList[$sFileList + 1]
$sFileList[$sFileList] = $nPath & "\" & $nFile
ElseIf FileGetAttrib($nPath & "\" & $nFile) = "D" And $nFlag = 1 Then
_Find($nPath & "\" & $nFile, $nType, $sFileList, $nFlag)
EndIf
WEnd
If $sFileList = 0 Then SetError(2, 2, "")
Return $sFileList
EndFunc 绝对能,麻烦楼主看帮助。或者faq 谢谢,wjc826194
我还有2个问题:
1、可以加ocx和dll等文件注册?
2、在显示窗口里只显示文件名?#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
Local$mylist, $Button1
#Region ### START Koda GUI section ### Form=
GUICreate("控件注册", 333, 451, 193, 125)
$mylist = GUICtrlCreateList("", 5, 32, 321, 360)
GUICtrlSetLimit(-1, 200)
GUICtrlSetData(-1, "")
$Button1 = GUICtrlCreateButton("开始", 8, 408, 317, 33, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Dim $FileList
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$FileList = _Find(@ScriptDir, "Ocx", $FileList)
For $i = 1 To $FileList
GUICtrlSetData($mylist,$FileList[$i], 1)
RunWait("regsvr32.exe /s "&$FileList[$i])
Next
EndSwitch
WEnd
Func _Find($nPath, $nType, ByRef $sFileList, $nFlag = 1)
If StringRight($nPath, 1) = "\" Then $nPath = StringTrimRight($nPath, 1)
If StringLeft($nType, 1) = "." Then $nType = StringTrimLeft($nType, 1)
Local $nSearch = FileFindFirstFile($nPath & "\*.*")
If $nSearch = -1 Then Return SetError(0)
If @error = 1 Then Return SetError(1, 1, "")
While 1
$nFile = FileFindNextFile($nSearch)
If @error Then ExitLoop
If StringRegExpReplace($nFile, '.+\.', '') = $nType Then
$sFileList += 1
If UBound($sFileList) <= $sFileList Then ReDim $sFileList[$sFileList + 1]
$sFileList[$sFileList] = $nPath & "\" & $nFile
ElseIf FileGetAttrib($nPath & "\" & $nFile) = "D" And $nFlag = 1 Then
_Find($nPath & "\" & $nFile, $nType, $sFileList, $nFlag)
EndIf
WEnd
If $sFileList = 0 Then SetError(2, 2, "")
Return $sFileList
EndFunc 按F1在里面找
页:
[1]