running SC.exe with parameters

Just starting out? Need help? Post your questions and find answers here.
optive
New User
New User
Posts: 2
Joined: Mon Mar 12, 2018 10:10 am

running SC.exe with parameters

Post by optive »

If I run the following with a service name "purebasicexample" then all is ok.
RunProgram("C:\Windows\System32\sc.exe" , "stop purebasicexample", "C:\Windows\System32\" , #PB_Program_Hide)

Everything worked because purebasicexample is one word

If I try with a split service name for example: pure basic example
RunProgram("C:\Windows\System32\sc.exe" , "stop pure basic example", "C:\Windows\System32\" , #PB_Program_Hide)
No error is shown but it does not work

How do I enter a service name with spaces?

In basic this would be: sc.exe stop "pure basic example"

Thanks
User avatar
Mijikai
Addict
Addict
Posts: 1360
Joined: Sun Sep 11, 2016 2:17 pm

Re: running SC.exe with parameters

Post by Mijikai »

->

Code: Select all

Debug #DQUOTE$ + "pure basic example" + #DQUOTE$
Marc56us
Addict
Addict
Posts: 1479
Joined: Sat Feb 08, 2014 3:26 pm

Re: running SC.exe with parameters

Post by Marc56us »

Or literal strings
Literal strings are declared using the " character. Escape sequences are supported using the ~ character before the literal string

Code: Select all

Debug ~"\"pure basic example\""
http://www.purebasic.com/documentation/ ... rules.html
Last edited by Marc56us on Mon Mar 12, 2018 10:42 am, edited 1 time in total.
User avatar
RSBasic
Moderator
Moderator
Posts: 1218
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: running SC.exe with parameters

Post by RSBasic »

Or:

Code: Select all

Debug ~"\"pure basic example\""
\\Edit:
Shit, I was too slow.
Image
Image
User avatar
Mijikai
Addict
Addict
Posts: 1360
Joined: Sun Sep 11, 2016 2:17 pm

Re: running SC.exe with parameters

Post by Mijikai »

or

Code: Select all

chr(34) + "x y z" + chr(34)
optive
New User
New User
Posts: 2
Joined: Mon Mar 12, 2018 10:10 am

Re: running SC.exe with parameters

Post by optive »

Mijikai wrote:or

Code: Select all

chr(34) + "x y z" + chr(34)
Many thanks to you all - my problem is solved :D
Post Reply