Help - Search - Members - Calendar
Full Version: Print Problem
The CD Forum > CD Shell and Boot Scriptor > Troubleshooting & Problems
tazgrominet
How can i print the character "\" ?

In fact i would store in variable a path relative to the root and print it

for exemple store in variable : "\images\menu\menu.img"

is it Possible ?
tazgrominet
Oups smile.gif

i have edited this because in fact it doesn't work

so question is always here :

how can store "\dir1\dir2\startup.bat" in a variable ?

can i escape "\" ?

thanks
tazgrominet
up wink.gif
BastCyric
Double the \\ or for paths use / since cdshell doesn't care and you don't have to do anything to escape them.

so either (using your example):

CODE
set mnuimg = "\\images\\menu\\menu.img"

or
CODE
set mnuimg = "/images/menu/menu.img"


Straight from the Documentation at cdshell.org

CODE
Print      C      S      script.csm
print [l/c/r] <message>
The print command will display a user specified message out on the screen.

The l, c, and r keywords specify left, center, or right justification respectively. The message is aligned to the left by default. If left justification is used, the message will be displayed beginning at the current cursor position. If center or right justification is used, the current cursor position is adjusted as necessary to align the text before the message is displayed. If the message contains lines longer than 80 characters, then it will be displayed in 80-character segments until the remainder is small enough to justify.

The message must be delimited by quotes ("). Any of the escape sequences listed below can be used in the message, however \t may only be used in center or right aligned messages.
\\  Backslash
\"  Double-quote character
\n  Newline
\t  Tab (see tabSize variable)
\ac  Change to center alignment and begin a new line.
\al  Change to left alignment and begin a new line.
\ar  Change to right alignment and begin a new line.
\c(#)  Change color. The color in parenthesis can be decimal or hex.
\c##  Change color. ## must be two hex digits.
\cxx  Change to the default text color.
\cXX  Change to the text highlight color.


Eric
tazgrominet
i have see this in documentation

but if i do

set mnuimg = "\\images\\menu\\menu.img"

print "$mnuimg"

he print me : magesenuenu.img

he doesn't print the backslash and delete the first letter after each "\\"
BastCyric
QUOTE
i have see this in documentation

but if i do

set mnuimg = "\\images\\menu\\menu.img"

print "$mnuimg"

he print me : magesenuenu.img

he doesn't print the backslash and delete the first letter after each "\\"


For each time you assign a string to a variable that you want to print out, you actually have to double the double \\. But then that variable will have double quotes in the string if you want to do something like show the gif or run the command.

Try this code:

CODE
set mnuimg = "\\\\images\\\\menu\\\\menu.img"
print "$mnuimg"
print "\n"

set mnuimgdir = "\\\\images\\\\menu"
set mnuimg = "$(mnuimgdir)\\\\menu.img"
print "$mnuimg"
print "\n"

set mnuimgdir = "\\\\\\\\images\\\\\\\\menu"
set mnuimg = "$(mnuimgdir)\\\\menu.img"
print "$mnuimg"
print "\n"


The first one prints what you would want (or expect):
CODE
\images\menu\menu.img


The second does not print what you would want (or expect):
I expected this one to print imagesmenu\menu.img
CODE
magesenu\menu.img


The third one prints what you would want:
CODE
\images\menu\menu.img


The problem is that you have to double the quotes for every time you would nest and assign a variable, you have to leave enough \ so that the print only picks up a '\\' where you want it to.

However, AFAIK (and I actually haven't tested this), you now cannot use any of those variables to do path related things, so you can't use them to actually chain a bootloader or run a diskimage.

Use a / instead of \ for path related things and you will be just fine.

Hope this helps.

Eric
tazgrominet
thanks

your last topic have help me very well and i find what i would.

this my result :

QUOTE
set mnuimg = "\\\\images\\\\menu\\\\menu.img"
print "$mnuimg"
result : \images\menu\menu.img
and now :

QUOTE
set mnuimg = "\\images\\menu\\menu.img"
set commandline = "\\images\\menu\\startup.bat"

bcdw boot $mnuimg $commandline


result : bcdw boot on the image and at the end he pass the command line to start the batch. This works perfectly.

Now my UBCD is fully updated with cdshell 2.1.4 and BCDW 2.0a1 and all works

thanks again BastCyric for your help
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2014 Invision Power Services, Inc.