yellowdog
(Starting to like KiXtart)
2005-06-14 05:21 PM
Variable concatenation

Hello,

The purpose of this mail is to write a script that would test the presence of a file in a certain directory.
How to script the presence of the file OK.TXT located in the directory of the user profile?

I suppose the script looks like approximately to (but it doesn't work .....):

SET PROFUSR=%userprofile%
IF NOT EXIST (%PROFUSR%\ + "OK.txt")

Litterally it should match to:
IF NOT EXIST ("C:\Documents and Settings\Username\OK.TXT")


Bryce
(KiX Supporter)
2005-06-14 05:25 PM
Re: Variable concatenation

Quote:

Hello,

The purpose of this mail is to write a script that would test the presence of a file in a certain directory.
How to script the presence of the file OK.TXT located in the directory of the user profile?

I suppose the script looks like approximately to (but it doesn't work .....):

SET PROFUSR=%userprofile%
IF NOT EXIST (%PROFUSR%\ + "OK.txt")

Litterally it should match to:
IF NOT EXIST ("C:\Documents and Settings\Username\OK.TXT")




the Syntax is a little off...

Code:

$UP = "%userprofile%"
if not exist($up + '\ok.txt')
;the file does not exist
endif



Mart
(KiX Supporter)
2005-06-14 05:29 PM
Re: Variable concatenation

This would do it.

Code:

$profile = "%userprofile%"
If Exist ($profile + "\ok.txt")
"put code here"
Else
"put other code here"
EndIf



[edit]
Bryce just beat me
[/edit]


AzzerShaw
(Seasoned Scripter)
2005-06-14 05:33 PM
Re: Variable concatenation

try

Code:
 
If Exist ("%userprofile%\OK.TXT")

?"whoo"

Else

;do nothing

EndIf





Mart
(KiX Supporter)
2005-06-14 05:36 PM
Re: Variable concatenation

LOL
Oops, var in a string
And it's not even a kix var.


yellowdog
(Starting to like KiXtart)
2005-06-15 09:49 AM
Re: Variable concatenation

OK it's working fine.

Thanks for your help......