Page 1 of 1 1
Topic Options
#165994 - 2006-08-16 07:20 PM Please help the dope
Thom Offline
Fresh Scripter

Registered: 2005-11-30
Posts: 39
I profess I am a dope.. I am having the hardest time write to a file in a folder that has spaces.. What is the syntax.. I am missing something here.. Also should I use the function writeline or comspec echo as I have been using.. I am trying to write to C:\Documents and Settings\thom.dombrowski and can not.. I can write elsewhere. Thanks in advance from all the other dopes out here.
_________________________
You'll never know, unless you ask.

Top
#165995 - 2006-08-16 07:26 PM Re: Please help the dope
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
let us see your script...
Top
#165996 - 2006-08-16 07:30 PM Re: Please help the dope
Thom Offline
Fresh Scripter

Registered: 2005-11-30
Posts: 39
Here is it.. It will write to $server and not $local

$serialstring="$SerialNumb2,@userid,@wksta,$ipaddress,$recordate"
$server="@lserver\netlogon\SerialNumbers\$lserver.txt"
$local="C:\Documents and Settings\thom.dombrowski\serialnum.txt"
shell '%comspec% /c ECHO '+$serialstring+' >> $server'
shell '%comspec% /c ECHO '+$serialstring+' >> $local'

Top
#165997 - 2006-08-16 08:00 PM Re: Please help the dope
eriqjaffe Offline
Hey THIS is FUN

Registered: 2004-06-24
Posts: 214
Loc: Arlington Heights, IL USA
Code:
shell "%comspec% /c ECHO " + $serialstring + " >> " + $server
shell "%comspec% /c ECHO " + $serialstring + " >> " + chr(34) + $local + chr(34)


That should do it.


Edited by eriqjaffe (2006-08-16 08:03 PM)

Top
#165998 - 2006-08-16 08:06 PM Re: Please help the dope
Thom Offline
Fresh Scripter

Registered: 2005-11-30
Posts: 39
Sorry that id nothing.. what was it, to begin with.. The problem lies in $local
Top
#165999 - 2006-08-16 08:10 PM Re: Please help the dope
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
Asuming that all variables get filled in a part of the script that comes before this part this should do the trick.

Code:

Break on
;
$serialstring = $SerialNumb2+","+@userid+","+@wksta+","+$ipaddress+","+$recordate
;
$local = %userprofile%
$server = @LSERVER + "\netlogon\SerialNumbers\" + $lserver + ".txt"
;
$rc = Open (1, $local + "\serialnum.txt", 5)
$rc = Open (2, $server + $lserver ".txt", 5)
$rc = WriteLine (1, $serialstring + @CRLF)
$rc = WriteLine (2, $serialstring + @CRLF)
$rc = Close (1)
$rc = Close (2)

_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#166000 - 2006-08-16 08:11 PM Re: Please help the dope
Thom Offline
Fresh Scripter

Registered: 2005-11-30
Posts: 39
Sorry my bad that does work, but what is the extra stuff??
Top
#166001 - 2006-08-16 08:19 PM Re: Please help the dope
Thom Offline
Fresh Scripter

Registered: 2005-11-30
Posts: 39
Ah Ha %userprofile% that will help greatly.. thanks, and I will try the writeline.. Forums are the balls...
Top
#166002 - 2006-08-16 08:28 PM Re: Please help the dope
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
Quote:

Sorry my bad that does work, but what is the extra stuff??




What extra stuff?
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#166003 - 2006-08-16 08:38 PM Re: Please help the dope
Thom Offline
Fresh Scripter

Registered: 2005-11-30
Posts: 39
Mark

Thanks for the help, was confussed by the char(34) 1st time I tried it, I had a problem.. But it is now resolved.. thanks.

Top
#166004 - 2006-08-16 08:47 PM Re: Please help the dope
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Don't know what char(34) is? Open up Notepad and holding down the [alt] key, tap 34 on the keypad and release the [alt] key.
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 507 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.06 seconds in which 0.027 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