Page 1 of 1 1
Topic Options
#196786 - 2009-11-20 01:21 PM Display @ Character
Murraymint Offline
Fresh Scripter

Registered: 2008-05-16
Posts: 5
Loc: West Sussex, United Kingdom
Simple question if you know the answer, how do I display the @ symbol. I am trying to build a dynamic script and I want to write @echo off but all I get in the batch file is <unknown:echo off.

Here's my code.

 PHP:
If $EncryptMyDocs = "TRUE" Open(1, "D:\script\encrypt.bat", 5) If @ERROR = 0 WriteLine(1,"@"+"echo off"+@CRLF) WriteLine(1, "CIPHER /E /S:" + '"$mydocs"' + " /A" + @CRLF) Close(1) Else Open(2, "D:\script\Error.log", 5) WriteLine(2, "file could not be opened" + " " + @ERROR) Goto "Exit" EndIf EndIf


Edited by Murraymint (2009-11-20 01:25 PM)

Top
#196787 - 2009-11-20 01:59 PM Re: Display @ Character [Re: Murraymint]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
It's a reserved character that introduces a macro, documented early in the manual. Other reserved characters are "$" and "%".

There are a number of ways to skin this cat, but the simplest is to repeat the reserved character:
 Code:
$vDiscard=WriteLine(1,"@@"+"echo off"+@CRLF)


Top
#196792 - 2009-11-20 03:05 PM Re: Display @ Character [Re: Richard H.]
Murraymint Offline
Fresh Scripter

Registered: 2008-05-16
Posts: 5
Loc: West Sussex, United Kingdom
Richard do you wnat a job

I do remember reading about the $ and needing to $$, guess I should start at the beginning of the manual again.

Thanks again.

Murray

Top
#196809 - 2009-11-21 08:44 PM Re: Display @ Character [Re: Murraymint]
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Or you set the NoVarsInStrings and NoMacrosInStrings options to ON, which negates the need to double up (escape) the special characters. There's even an FAQ on it.
_________________________
There are two types of vessels, submarines and targets.

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
1 registered (mole) and 1300 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.052 seconds in which 0.023 seconds were spent on a total of 13 queries. Zlib compression enabled.

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