Hallo,
scheinbar gibt es ein kleines Problem mit der Zip.au3 in Verbindung mit einem Command-Line Parameter.
Ziel ist dass das Script erkennt ob per commandline ein parameter mitgegeben wurde z.B: /path=c:\testfolder
Wenn das Script ohne commandline-parameter gestartet wurde, funktioniert es, wenn ich jedoch das script über eine batchdatei mit parameter aufrufe, erhalte ich
folgende Fehlermeldung: array variable has incorrect number of subscripts or subscript dimension range exceeded.
Weis jemand rat, ich weis nicht warum es in Verbindung mit der Zip.au3 fehlschlägt ??
Mein Script (mit Fehlermeldung):
#include <Process.au3>
#include <Array.au3>
#include "Zip.au3"
;**************** Start Auswahl Datei-Speicherort ****************
$DSort = FileSelectFolder("Speicherort auswählen ...", "", 4, "")
If $DSort <> "" Then
DirCreate("LOGS")
Else
MsgBox(0, "Collect", "Abbrechen wurde gewählt" & @CRLF & "" & @CRLF & "Script wird beendet")
Exit
EndIf
$FileNameKC = "\Collect_" & @ComputerName & "_" & @MDAY & "_" & @MON & "_" & @YEAR
; checking for command-line parameters
If $CmdLine[0] = 0 Then
MAIN()
Exit
Endif
If StringInStr($CmdLine[1],"/path=",0) Then
;ConsoleWrite($CmdLine[1])
$CmdL=StringSplit($CmdLine[1],"=")
If StringLen($CmdL[2])>0 Then
MsgBox(0, "", $CmdL[2])
Else
HELPME()
Endif
Else
HELPME()
Endif
func MAIN()
;**************** Archiv erstellen und Dateien packen ****************
$Archiv = $DSort & $FileNameKC & ".zip" ; Ort und Name des Archives
$Archivfile = @TempDir & "\LOGS" ; Datei, Ordner welche ins Archiv sollen
$Zip = _Zip_Create($Archiv)
_Zip_AddFile($Zip,$Archivfile)
Exit
EndFunc
func HELPME()
MsgBox(0, "tool.exe", "available parameters: /path=YOURPATH")
Exit
EndFunc
Mein Script (ohne Fehlermeldung)
; checking for command-line parameters
If $CmdLine[0] = 0 Then
MAIN()
Exit
Endif
If StringInStr($CmdLine[1],"/path=",0) Then
;ConsoleWrite($CmdLine[1])
$CmdL=StringSplit($CmdLine[1],"=")
If StringLen($CmdL[2])>0 Then
MsgBox(0, "", $CmdL[2])
Else
HELPME()
Endif
Else
HELPME()
Endif
func MAIN()
MsgBox(0, "MAIN", "ok, its working - no paramaters given")
Exit
EndFunc
func HELPME()
MsgBox(0, "tool.exe", "available parameters: /path=YOURPATH")
Exit
EndFunc