Seite 1 von 1

[Solved] FileExists liefert falsches Ergebnis

Verfasst: 19 Nov 2020, 10:12
von S.Kunimünch
Hallo Zusammen,

ich habe schon hier im Forum gelesen und auch schon google ausgereizt, finde aber meinen Fehler nicht. Ich habe folgendes Script, bei dem ich Abfrage ob es einen Ordner gibt.

Code: Alles auswählen

[Initial]
ExitOnError=true
StayOnTop = true

[Actions]
DefVar $ProductId$
Defvar $Installfile$
DefVar $ExitCode$
DefVar $Zielpfad$
DefVar $TestPath$

set $ProductId$ = "Microsoft Office 365 Business"
set $TestPath$ = "c:\dkit\"

ShowBitmap "%ScriptPath%\office365_business_x86.png" "MS Office 365"

Message "Installing " + $ProductId$
comment "Start setup program"
set $Installfile$ =  "setupodt.exe"

	Sub_CheckPath
	Files_copy
	PatchTextFile_Outlook "$Zielpfad$\config-business.xml"
	Winbatch_install
	Files_delete
	Sub_check_exit_code

[Sub_CheckPath]
if FileExists($TestPath$)
	set $Zielpfad$ = "c:\dkit"
else
	set $Zielpfad$ = "C:\WetIT"
endif
Immer wenn er den Pfad überprüft kommt er auf True, obwohl es den Ordner nicht gibt. Hier das Log dazu

Code: Alles auswählen

(93)      [6] [Nov 19 10:03:21:555] [office365_business_x86] Set  $ProductId$ = "Microsoft Office 365 Business"
(94)      [6] [Nov 19 10:03:21:555] [office365_business_x86]   The value of the variable "$ProductId$" is now: "Microsoft Office 365 Business"
(95)      [6] [Nov 19 10:03:21:555] [office365_business_x86] Set  $TestPath$ = "c:\dkit\"
(96)      [6] [Nov 19 10:03:21:555] [office365_business_x86]   The value of the variable "$TestPath$" is now: "c:\dkit\"
(97)      [5] [Nov 19 10:03:21:600] [office365_business_x86] message Installing Microsoft Office 365 Business
(98)      [5] [Nov 19 10:03:21:603] [office365_business_x86] comment: Start setup program
(99)      [6] [Nov 19 10:03:21:603] [office365_business_x86] Set  $Installfile$ =  "setupodt.exe"
(100)     [6] [Nov 19 10:03:21:604] [office365_business_x86]   The value of the variable "$Installfile$" is now: "setupodt.exe"
(101)     [6] [Nov 19 10:03:21:604] [office365_business_x86] 
(102)     [6] [Nov 19 10:03:21:604] [office365_business_x86] ~~~~~~~ Start Sub ~~~~~~~  Sub_CheckPath
(103)     [6] [Nov 19 10:03:21:604] [office365_business_x86] If
(104)     [6] [Nov 19 10:03:21:604] [office365_business_x86]   Starting query if file exist ...
(105)     [6] [Nov 19 10:03:21:604] [office365_business_x86]   FileExists($TestPath$)   <<< result true
(106)     [6] [Nov 19 10:03:21:604] [office365_business_x86] Then
(107)     [6] [Nov 19 10:03:21:604] [office365_business_x86]   Set  $Zielpfad$ = "c:\dkit"
(108)     [6] [Nov 19 10:03:21:604] [office365_business_x86]     The value of the variable "$Zielpfad$" is now: "c:\dkit"
(109)     [6] [Nov 19 10:03:21:604] [office365_business_x86] Else
(110)     [6] [Nov 19 10:03:21:605] [office365_business_x86] EndIf
(111)     [6] [Nov 19 10:03:21:605] [office365_business_x86] 
(112)     [6] [Nov 19 10:03:21:605] [office365_business_x86] ~~~~~~~ End Sub   ~~~~~~~  Sub_CheckPath
(113)     [6] [Nov 19 10:03:21:605] [office365_business_x86] 
(114)     [5] [Nov 19 10:03:21:605] [office365_business_x86] Execution of: Files_copy
(115)     [5] [Nov 19 10:03:21:605] [office365_business_x86] 
(118)     [3] [Nov 19 10:03:21:605] [office365_business_x86]   Error:  Directory c:\dkit does not exist and cannot be created
(119)     [5] [Nov 19 10:03:21:605] [office365_business_x86] Finished of: Files_copy
OPSI selbst schreibt ja sogar, dass es den Pfad nicht gibt. Was mache ich falsch? Hab ich nen Denkfehler drin?

Vielen Dank schonmal für eure Hilfe

Gruss, Sascha

Re: FileExists liefert falsches Ergebnis

Verfasst: 24 Nov 2020, 13:19
von S.Kunimünch
Hat keiner ne Idee, an was es liegen könnte? Habe noch keine Lösung für mich gefunden :?

Re: FileExists liefert falsches Ergebnis

Verfasst: 24 Nov 2020, 13:49
von r.roeder
Es ist seltsam, ich habe das gepostete Skript kopiert, es liefert bei mir fileexists false:

Code: Alles auswählen

6] [2020-11-24 13:41:51.053] [] ~~~~~~~ Start Sub ~~~~~~~  Sub_CheckPath
[6] [2020-11-24 13:41:51.061] [] If
[6] [2020-11-24 13:41:51.070] []   Starting query if file exist ...
[6] [2020-11-24 13:41:51.072] []   Not found: "c:\dkit\":
[6] [2020-11-24 13:41:51.089] []   FileExists($TestPath$)   <<< result false
[6] [2020-11-24 13:41:51.096] [] Then
[6] [2020-11-24 13:41:51.106] [] Else
[6] [2020-11-24 13:41:51.116] []   Set  $Zielpfad$ = "C:\WetIT"
[6] [2020-11-24 13:41:51.120] []     The value of the variable "$Zielpfad$" is now: "C:\WetIT"
[6] [2020-11-24 13:41:51.130] [] EndIf
[6] [2020-11-24 13:41:51.137] [] 
[6] [2020-11-24 13:41:51.150] [] ~~~~~~~ End Sub   ~~~~~~~  Sub_CheckPath
[6] [2020-11-24 13
???

Re: FileExists liefert falsches Ergebnis

Verfasst: 24 Nov 2020, 14:03
von S.Kunimünch
Oh verdammt.....ich habe mir nochmals das Laufwerk angeschaut und es gibt den Ordner wirklich nicht.......aber es gab ne versteckte Datei mit dem Namen :oops: :oops: :oops: .....keine Ahnung warum.

Sorry für die Störung und danke trotzdem für die Hilfe.

:oops: :oops: :oops: :roll: :roll: