关于if表达式问题?
看不出哪里不对呀!可就是提示表达示错误,兄弟们帮我看一下是哪里出错了,改正一下Global $FileDir=@ScriptDir &"\RunFile"if $Cmdline = "" then
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", "Runs", "REG_SZ",@ScriptDir& "\" &"Run.exe /R")
Exit
Endif
if $Cmdline = "/D" then
RegDelete("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", "Runs")
Exit
Endif
If $CmdLine = "/R" Then
If Not FileExists($FileDir) Then
MsgBox(4096, "警告", "程序目录未发现程序文件夹 RunFile,准备重新写入。", 10)
DirCreate($FileDir)
Exit
EndIf
$search = FileFindFirstFile($FileDir &"\*.exe")
runexe()
$search = FileFindFirstFile($FileDir &"\*.bat")
runbat()
$search = FileFindFirstFile($FileDir &"\*.reg")
regedit()
Func runexe();运行exe
If $search = -1 Then
EndIf
While 1
$file = FileFindNextFile($search)
If @error Then ExitLoop
Run($FileDir&"\" &$file)
WEnd
FileClose($search)
endfunc
Func runbat();运行bat
If $search = -1 Then
EndIf
While 1
$file = FileFindNextFile($search)
If @error Then ExitLoop
Run($FileDir&"\" &$file, "",@SW_HIDE)
WEnd
FileClose($search)
endfunc
Func regedit();注册表
If $search = -1 Then
EndIf
While 1
$file = FileFindNextFile($search)
If @error Then ExitLoop
Run(@ComSpec & " /c " & "regedit.exe /s " &$FileDir&"\" &$file, "", @SW_HIDE)
WEnd
FileClose($search)
endfunc
EndIf
11行IF 没有结束语 养成代码缩进的好习惯就不会有这问题了 自从用了Ctrl+t后我就没有出过类似问题 回复 1# shounei
function 放到IF里面去了。把最后的endif放到function定义前面去。。。
页:
[1]