Jump to content

FileRead Text


Recommended Posts

Hello

$fHandle = FileOpen(@SystemDir & "\myfile.txt", 0)

$char = FileRead($fHandle, 99999999)

FileClose($fHandle)

$stopservice = StringSplit($char, ",")

For $i = 1 To $stopservice[0]RunWait("net.exe stop " & $stopservice[$i],"",@SW_HIDE)

Next

myfile.txt contains services but when i add services like

this

its not working

service1,

service2,

etc

its working

service1,service2, etc........

-----------------

Link to comment
Share on other sites

I don't even see a question here, but if you want to add the services to your text file line by line just do it like:

service1

service2

etc.

and change

$stopservice = StringSplit($char, ",")

to

$stopservice = StringSplit($char, @CRLF)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...