Sign in to follow this  
Followers 0
Clever1mba

FileRead Text

3 posts in this topic

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........

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

Share this post


Link to post
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)

Share this post


Link to post
Share on other sites

Hello

$stopservice = StringSplit($char, @CRLF)

it works fine thanks buddy

Share this post


Link to post
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
Sign in to follow this  
Followers 0