4 Replies - 1281 Views - Last Post: 28 July 2012 - 03:51 PM Rate Topic: -----

#1 IndiaJonathan  Icon User is offline

  • New D.I.C Head

Reputation: -2
  • View blog
  • Posts: 12
  • Joined: 27-July 12

reading a text file into a string (using batch)

Posted 28 July 2012 - 03:24 PM

Hello everyone! I have a rather simple question today, I am attempting to load a string in batch from a text file, the text file would look like this
true

or, the text file could look like this
false

I simply need to load these into a string so I can say, if stringname=="false" then do something
else if stringname=="true" then do something different
else do nothing,
thanks

Is This A Good Question/Topic? 0
  • +

Replies To: reading a text file into a string (using batch)

#2 Skydiver  Icon User is online

  • Code herder
  • member icon

Reputation: 3618
  • View blog
  • Posts: 11,276
  • Joined: 05-May 12

Re: reading a text file into a string (using batch)

Posted 28 July 2012 - 03:27 PM

Which scripting language are you using when you say "batch"? PowerShell? Perl? CMD? 4-Dos? VBScript? JScript?

If this were truly a C/C++ question, you would just read the string in as you would regularly do in any other C/C++ program.
Was This Post Helpful? 0
  • +
  • -

#3 IndiaJonathan  Icon User is offline

  • New D.I.C Head

Reputation: -2
  • View blog
  • Posts: 12
  • Joined: 27-July 12

Re: reading a text file into a string (using batch)

Posted 28 July 2012 - 03:31 PM

Cmd, and it wasn't actually meant to be a c/c++ question, I just forgot to change it to batch like a smart person, lol
Was This Post Helpful? 0
  • +
  • -

#4 IndiaJonathan  Icon User is offline

  • New D.I.C Head

Reputation: -2
  • View blog
  • Posts: 12
  • Joined: 27-July 12

Re: reading a text file into a string (using batch)

Posted 28 July 2012 - 03:40 PM

So, how would you read a file into as string using cmd?
Was This Post Helpful? 0
  • +
  • -

#5 Skydiver  Icon User is online

  • Code herder
  • member icon

Reputation: 3618
  • View blog
  • Posts: 11,276
  • Joined: 05-May 12

Re: reading a text file into a string (using batch)

Posted 28 July 2012 - 03:51 PM

Look at the for command.

Sent from my T-Mobile G2 using Tapatalk 2
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1