Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

escape a newline character

Posted on 2006-06-26
7
Medium Priority
?
1,758 Views
Last Modified: 2010-07-27
I'm constructing a statement that the Window's command shell passes on to an application.  As part of that statement, I need to include a newline.  I need that newline not to terminate the statement, but to be passed along to the application.  I know that I can escape some special characters with a backslash.  But, how can I escape a newline?

Here is a simplified example of the issue.  -a, -b, -c are flags that signal the meaning of the following parameter information (embedded in double quotes).

c:\myexe.exe -a "a quoted sequence of information" -b "a quoted sequence that has a double quote embedded in it (\"), escaped with a backslash" -c "a quoted sequence that needs a <NEWLINE> that allows the quoted sequence to continue"

To get a double-quote (parameter -b), I just have to do: \".  What is the equivalent for a newline?

Thanks.
0
Comment
Question by:dannykrouk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 10

Expert Comment

by:For-Soft
ID: 16989989
As far as I know, there is no global "special character" you can use.

The program has to support special character formatting, and it will have own special haracter definitions, probably.
0
 
LVL 43

Accepted Solution

by:
Steve Knight earned 500 total points
ID: 16990561
When you say newline is it looking for a line feed (10) carriage return (13) or both?  You might be able to do this using EDIT

Enter Control P then press Control M for ASCII 13 (carriage return) and it inserts a small character.

How the program will handle this I don't know but it does to appear to work in that DOS still sees it as one line.

0
 
LVL 14

Expert Comment

by:cwwkie
ID: 16994944
> -c "a quoted sequence that needs a <NEWLINE> that allows the quoted sequence to continue"

Can't you use something like -c "file:input.txt", and in your exe, read the file input.txt?
0
Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

 
LVL 43

Expert Comment

by:Steve Knight
ID: 17006897
Did it work?  Why the B grade because you ask something that IMHO is not possible though I gave you a way of getting a CR into the commandline, whether it works for your app I don't know of course.
0
 

Author Comment

by:dannykrouk
ID: 17010291
Yes, it did work.  I gave you a "B" because I did not read the Answer Grading guidelines carefully.  You deserve an "A".  I'm contacting a moderator to ask that the grade be upgraded.
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 17013725
Thankyou, appreciated.  

Steve
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One of my most closely kept secrets is revealed in this discussion How to output text on the same line This question was recently posted in EE by Simon336697 (http://www.experts-exchange.com/Programming/Languages/Scripting/Shell/Batch/Q_2459…
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question