Thom
|
(Fresh Scripter)
|
2006-08-16 07:20 PM
|
|
|
|
|
Please help the dope
|
|
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.
|
Lonkero
|
(KiX Master Guru)
|
2006-08-16 07:26 PM
|
|
|
|
|
Re: Please help the dope
|
|
let us see your script...
|
Thom
|
(Fresh Scripter)
|
2006-08-16 07:30 PM
|
|
|
|
|
Re: Please help the dope
|
|
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'
|
eriqjaffe
|
(Hey THIS is FUN)
|
2006-08-16 08:00 PM
|
|
|
|
|
Re: Please help the dope
|
|
Code:
shell "%comspec% /c ECHO " + $serialstring + " >> " + $server shell "%comspec% /c ECHO " + $serialstring + " >> " + chr(34) + $local + chr(34)
That should do it.
|
Thom
|
(Fresh Scripter)
|
2006-08-16 08:06 PM
|
|
|
|
|
Re: Please help the dope
|
|
Sorry that id nothing.. what was it, to begin with.. The problem lies in $local
|
Mart
|
(KiX Supporter)
|
2006-08-16 08:10 PM
|
|
|
|
|
Re: Please help the dope
|
|
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)
|
Thom
|
(Fresh Scripter)
|
2006-08-16 08:11 PM
|
|
|
|
|
Re: Please help the dope
|
|
Sorry my bad that does work, but what is the extra stuff??
|
Thom
|
(Fresh Scripter)
|
2006-08-16 08:19 PM
|
|
|
|
|
Re: Please help the dope
|
|
Ah Ha %userprofile% that will help greatly.. thanks, and I will try the writeline.. Forums are the balls...
|
Mart
|
(KiX Supporter)
|
2006-08-16 08:28 PM
|
|
|
|
|
Re: Please help the dope
|
|
Quote:
Sorry my bad that does work, but what is the extra stuff??
What extra stuff?
|
Thom
|
(Fresh Scripter)
|
2006-08-16 08:38 PM
|
|
|
|
|
Re: Please help the dope
|
|
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.
|
Les
|
(KiX Master)
|
2006-08-16 08:47 PM
|
|
|
|
|
Re: Please help the dope
|
|
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.
|