#143938 - 2005-07-20 05:02 PM
Checking on a path that is a variable
|
Roberto_Koempel
Fresh Scripter
Registered: 2005-07-05
Posts: 34
Loc: Germany
|
Hi there,
I have a script running that checks for the IP-Adress of the machine and assembles with it a subnetspecific path. This path is put into a variable named $ROCPATH
To verify that this path exists I try to check on it via the "If Exist" statement. That does not work - it seems that I use the wrong syntax or command because whatever I try the script finds out that the path does not exist and moves on to the command after the "else" statement. Of course I verified that the path exists.
Here is my script (I hope you don't mind the german labels) --------------------------------cut-------------------------------- cls Dim $Version Dim $Name Dim $AV DIM $IPARR[3] $CLASS=10
GOSUB FINDIP
IF Exist ("C:\Programme\Norton AntiVirus\")
$IPADR=Join(Split(Join(Split($CORIP," "),""),"."),".") $NAVDIR=Join(Split(Join(Split($CORIP," "),""),".",3),"_") $IPROC=Join(Split(Join(Split($CORIP," "),""),".",3),".")+".240" $ROCPATH="\\"+$IPROC+"\vphome$$\groups\"+$NAVDIR
debug on
IF Exist ($ROCPATH) COPY "$ROCPATH\grc.dat" "C:\Programme\Norton AntiVirus\"
ELSE COPY "\\B21FS0999001\vphome\clt-inst\win32\grc.dat" "C:\Programme\Norton AntiVirus\" ENDIF $AV=NAV
Gosub openfile Goto ausgang Endif
$Version = ReadValue("HKEY_LOCAL_MACHINE\Software\ComputerAssociates\eTrustAntivirus\CurrentVersion" , "Version") IF $Version <> "7.0" Call "\\$Anmeldeserver\Netlogon\mailca7.scr" IF @ERROR <> 0 $Name = @WKSTA + " " + @USERID + " " + $CORIP Use y: "\\ss06\ca7tst" Go y: RD $Name MD $Name Use y: /del Endif Endif IF exist ("c:\programme\ca\eTrust Antivirus\00000001.qsd\00000011.job") $AV = eTrust Gosub openfile Else Copy "\\ss06\eTrust$$\*.*" "c:\programme\ca\eTrust Antivirus\00000001.qsd" $AV = eTrust Gosub openfile Endif :ausgang Return
:FINDIP $CORIP=@IPADDRESS0 $IPARR=Split(Join(Split($CORIP," "),""),".") if $IPARR[0]<>$CLASS
$CORIP=@IPADDRESS1 $IPARR=Split(Join(Split(@IPADDRESS1," "),""),".") if $IPARR[0]<>$CLASS
$CORIP=@IPADDRESS2 $IPARR=Split(Join(Split(@IPADDRESS2," "),""),".") if $IPARR[0]<>$CLASS
$CORIP=@IPADDRESS3 $IPARR=Split(Join(Split(@IPADDRESS3," "),""),".") if $IPARR[0]<>$CLASS endif endif endif endif Return :Openfile IF Open(1, "\\ss06\locoscan$\scanlist.csv" , 5 ) = 0 $x = WriteLine(1, @WKSTA + " , " + @USERID + " , " + @PRODUCTTYPE + " , " + $CORIP + " , " + @ADDRESS + " , " + @DATE + " , " + $AV + @CRLF) Close(1) Return Endif IF Open(2, "\\ss06\locoscan$\scanlist2.csv" , 5 ) = 0 $x = WriteLine(2, @WKSTA + " , " + @USERID + " , " + @PRODUCTTYPE + " , " + $CORIP + " , " + @ADDRESS + " , " + @DATE + " , " + $AV + @CRLF) Close(2) Return Endif IF Open(3, "\\ss06\locoscan$\scanlist3.csv" , 5 ) = 0 $x = WriteLine(3, @WKSTA + " , " + @USERID + " , " + @PRODUCTTYPE + " , " + $CORIP + " , " + @ADDRESS + " , " + @DATE + " , " + $AV + @CRLF) Close(3) Return Endif IF Open(4, "\\ss06\locoscan$\scanlist4.csv" , 5 ) = 0 $x = WriteLine(4, @WKSTA + " , " + @USERID + " , " + @PRODUCTTYPE + " , " + $CORIP + " , " + @ADDRESS + " , " + @DATE + " , " + $AV + @CRLF) Close(4) Return Endif Return --------------------------------paste--------------------------------
_________________________
Serenity: You can't stop the Signal!
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 2220 anonymous users online.
|
|
|