|
||||||
| General Programming Non language specific, Assembly, Linux/Unix, Mac and anything not covered in other topics. Talk about Programming Theory here. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
Hey, I was wondering if there is a way to use dos to read text files. i am writing a script that will open a text file from a flash drive and then read the contents (it will only be 1 word), and then store whatever is in there as a variable. I know that there also has to be a way to do it in bash, so if someone could help me out with either of those, that would be great.
|
| Sponsored Links |
|
|
|
|||||
|
Try this:
Code:
@echo off
setlocal enabledelayedexpansion
set SEPARATOR=/
set filecontent=
for /f "delims=" %%a in ("YourFile.txt") do (
set currentline=%%a
set filecontent=!filecontent!%SEPARATOR%!currentline!
)
echo The file contents are: %filecontent%
Code:
someVariable=`cat <filename>`
__________________
CodeCall Blog | CodeCall Wiki | Shareware Site | Linux Forum | Write a Blog The CodeCall Wiki is now fully integrated with vBulletin users! Check it out and add some new pages! |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Batch Programming Help | InfiniteSpawn | General Programming | 11 | 08-20-2008 10:17 PM |
| Batch help-xcopy command | arod | General Programming | 1 | 07-03-2008 07:20 AM |
| How to create a batch file in vb6 ? | kresh7 | Visual Basic Programming | 3 | 12-23-2007 03:08 PM |
| Batch File Help | ineedhelp | General Programming | 4 | 11-15-2007 08:04 PM |
| planning with batch file | frysay | General Programming | 3 | 05-29-2007 04:59 AM |
| WingedPanther | ........ | 2753.6 |
| Xav | ........ | 2704 |
| Brandon W | ........ | 1702.32 |
| John | ........ | 1207.73 |
| marwex89 | ........ | 1175.24 |
| morefood2001 | ........ | 966.05 |
| dcs | ........ | 655.75 |
| Steve.L | ........ | 475.59 |
| orjan | ........ | 418.58 |
| Aereshaa | ........ | 383.54 |