Page 1 of 1 1
Topic Options
#141589 - 2005-06-14 05:21 PM Variable concatenation
yellowdog Offline
Starting to like KiXtart

Registered: 2005-06-14
Posts: 102
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")

Top
#141590 - 2005-06-14 05:25 PM Re: Variable concatenation
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3166
Loc: Houston TX
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


Top
#141591 - 2005-06-14 05:29 PM Re: Variable concatenation
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4667
Loc: The Netherlands
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]


Edited by Mart (2005-06-14 05:37 PM)
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#141592 - 2005-06-14 05:33 PM Re: Variable concatenation
AzzerShaw Offline
Seasoned Scripter
****

Registered: 2003-02-20
Posts: 510
Loc: Cheltenham, England
try

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

?"whoo"

Else

;do nothing

EndIf



_________________________
If at first you don't succeed, try again. Then quit. There's no use being a damn fool about it. - W.C Fields

Top
#141593 - 2005-06-14 05:36 PM Re: Variable concatenation
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4667
Loc: The Netherlands
LOL
Oops, var in a string
And it's not even a kix var.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#141594 - 2005-06-15 09:49 AM Re: Variable concatenation
yellowdog Offline
Starting to like KiXtart

Registered: 2005-06-14
Posts: 102
OK it's working fine.

Thanks for your help......

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 290 anonymous users online.
Newest Members
Praveer, Ollero, rayyo, Foxlicht, DonChild
17742 Registered Users

Generated in 0.075 seconds in which 0.055 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org