![]() |
![]() |
![]() |
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
|||
| Welcome
to Tech Support Forum home to more then 136,000 problems solved. Issues
have included: Spyware, Malware, Virus Issues, Windows, Microsoft,
Linux, Networking, Security, Hardware, and Gaming Getting your
problem solved is as easy as: 1. Registering for a free account 2. Asking your question 3. Receiving an answer Registered members: * See fewer ads. * And much more..
|
| Want to know how to post a question? click here | Having problems with spyware and pop-ups? First Steps |
|
|||||||
| Programming A discussion forum for programs and programming used in tech-related businesses. |
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) |
|
Registered User
Join Date: May 2009
Posts: 18
OS: Windows 2005
|
Hi i have a requirement to re-direct the list of DOS commands into a text file with a blank space inbetween them
eg: echo "Y:\Drive\tar" > test.txt echo "-cf test.tar" >> test.txt echo "*.xml" >> test.txt so i need to print Y:\Drive\tar -cf test.tar *.xml in test.txt Instead its getting printed as Y:\Drive\tar -cf test.tar *.xml after printing the command pass the line as an input to the command prompt and i should execute that line. Kindly help me in doing this. |
|
|
|
| Important Information |
|
Join the #1 Tech Support Forum Today - It's Totally Free!
TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free. Join TechSupportforum.com Today - Click Here |
|
|
#2 (permalink) |
|
TSF Enthusiast
Join Date: Mar 2009
Location: Portland, OR
Posts: 815
OS: MS-Dos 6.22 - Win7
|
Re: script to print text without new line character
You can't. Echo will output a CR/LF after each line.
The quotes will be echoed, so don't include them unless they are really needed, like around a file name. Just Echo the three parts all on one line: Code:
>test.txt Echo "Y:\Drive\tar" -cf test.tar *.xml Copy test.txt test.bat Call test.bat Del Test.bat Code:
Set _CmdLine="Y:\Drive\tar" -cf test.tar *.xml >test.txt Echo.%_CmdLine% %_CmdLine% Code:
>test.txt Echo "Y:\Drive\tar"
>>test.txt Echo -cf test.tar
>>test.txt Echo *.xml
SetLocal EnableDelayedExpansion
Set _CmdLine=
For /F "Tokens=1 Delims=" %%I In ('Type Test.txt') Do Set _CmdLine=!_CmdLine! %%I
Set _CmdLine=%_CmdLine:~1%
>test.txt Echo %_CmdLine%
%_CmdLine%
__________________
Microsoft MVP - Windows Desktop Experience Of course I know all the answers; I just don't always match the answers to the right questions. Rated R for Violence -- When your PC flies through a window, that's violent, right? Last edited by TheOutcaste; 09-28-2009 at 10:01 PM. |
|
|
|
|
|
#3 (permalink) |
|
Registered User
Join Date: May 2009
Posts: 18
OS: Windows 2005
|
Re: script to print text without new line character
Hey thank you so much! its working great!!!
I need one more help too.... I have few lines in my test.txt file (which was echo from the DOS command) like Y:\Drive\tar DW_Bank*.xml DW_Bank.tar DW_Day*.xml DW_Day.tar DW_Daily.xml DW_Daily.tar I want this to be Y:\Drive\tar DW_Bank*.xml DW_Bank.tar Y:\Drive\tar DW_Day*.xml DW_Day.tar Y:\Drive\tar DW_Daily*.xml DW_Daily.tar Is this possible? Need your help in this regard!! |
|
|
|
|
|
#4 (permalink) |
|
TSF Enthusiast
Join Date: Mar 2009
Location: Portland, OR
Posts: 815
OS: MS-Dos 6.22 - Win7
|
Re: script to print text without new line character
Unless there is a fixed pattern to these lines, it would be nearly impossible to write a script. and unless there are hundreds of lines, probably faster to just edit by hand, using Notepad++ or Notetab Light, where you can search for lines containing only Y:\Drive\tar, then easily combine them with a few clicks/key presses.
Is it always Y:\Drive\tar followed by 3 pairs of lines you need to combine as you show? Or is it actually like this: Y:\Drive\tar DW_Bank*.xml DW_Bank.tar Y:\Drive\tar DW_Day*.xml DW_Day.tar Y:\Drive\tar DW_Daily.xml DW_Daily.tar Does there happen to be a space (or multiple spaces) after Y:\Drive\tar? If some have none, some have one, some have more, you have to allow for that. If none of the file names or paths have spaces, it would be easier, but if any have spaces that gets complicated real quick.
__________________
Microsoft MVP - Windows Desktop Experience Of course I know all the answers; I just don't always match the answers to the right questions. Rated R for Violence -- When your PC flies through a window, that's violent, right? |
|
|
|
![]() |
| Thread Tools | |
|
|