English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I'd like the code for an MS-DOS batch file which takes in the first 8 characters from the file "data.dat" and then writes a new file "output.dat" containing just those first 8 characters.

For Example:
If "data.dat" contains the text:
hello_are_you_ok

the batch file should write the following into "output.dat":
hello_ar

Could answerers please leave the code in their answers (please stick to DOS commands as their is a reason for this, please do not ask me to write it in another language).

2006-09-22 14:33:14 · 5 answers · asked by Rich 5 in Computers & Internet Programming & Design

"DOS commands are not powerful enough" says someone (I cannot be bothered with their name) - what about a simple TYPE command with something else thrown in there to only allow it to type the first 8 characters?

2006-09-22 15:36:12 · update #1

I CAN read the first file, but I am not going to site and retype 8 characters myself - there are many files I have to do this with. I know that you would use '>' to get it into another file, my problem is the 8 characters bit. And I also said NO OTHER LANGUAGES. Is that really that diffucult to understand?

2006-09-23 02:14:39 · update #2

5 answers

I'm so old the only 'batch' that springs to MY mind is batch BAKING - probably need to ask your Nana about THAT one!

Good luck finding what you're looking for - sorry I couldn't help...but if you ever need a good scone recipe let me know.

2006-09-22 14:40:41 · answer #1 · answered by franja 6 · 0 1

i have the impression u can't read the first file, so there's no way u would be able to do that. But if u can figure out a way, then u can use the following to pipe the info into the second files
'read-file-command' > output.dat

2006-09-22 15:52:39 · answer #2 · answered by rice kid 4 · 0 1

You need more powerful scripting language than DOS/Windows shell gives you.
It can be either PHP, or PERL. You can also install cygwin (UNIX emulator for Windows) and sitting within your Windows box, use almost all UNIX power. All tools mentioned above are completly free.

2006-09-22 15:56:09 · answer #3 · answered by alakit013 5 · 0 1

no longer confident if you should do it, because having 2 moves on an analogous line in reality works for particular courses with pre-particular parameters, like beginning firefox, and then a particular, or various certain web pages.

2016-11-23 16:14:12 · answer #4 · answered by orson 4 · 0 0

No can do. DOS commands are not powerful enough to read files.

2006-09-22 15:06:17 · answer #5 · answered by jacinablackbox 4 · 0 1

fedest.com, questions and answers