PDA

View Full Version : problem with =



wasim21k
04-06-2009, 08:06 AM
hi guys,
another problem after long time,
sorry if this is answered before, i m trying to do


File.Run("sc", "create myservice start= auto binPath= c:\\temp\\mr.exe obj= .\administrator password= Password1", -1, true);

this is actually dos command to create service if i just runt this command from command prompt it works fine but if i place it in my app it does nothing and obviously gives no error either. so my doubt is = in this line, can some one please shed some light on this and point me to right direction.

reteset
04-06-2009, 08:11 AM
Maybe This ....?

start= auto binPath= c:\\temp\\mr.exe obj= .\administrator password= Password1", -1, true);

wasim21k
04-06-2009, 08:30 AM
nop,
i even can not run half of this

File.Run("sc", "create myservice start= auto binPath= c:\\temp\\mr.exe

from this i think = is not passing to sc command

mwreyf1
04-06-2009, 08:40 AM
This worked for me on XP Pro SP3


File.Run("sc.exe", "create myservice start= auto binPath= c:\\temp\\mr.exe", "", SW_SHOWNORMAL, false);

Ulrich
04-06-2009, 08:44 AM
You better start the program properly, like


File.Run(_SystemFolder .. "\\sc.exe", "create myservice", "", SW_SHOWNORMAL, true);

Just "sc" does not make a complete program name...

Ulrich

wasim21k
04-06-2009, 09:33 AM
thanks for reply,
File.Run(_SystemFolder .. "\\sc.exe", "create myservice start= auto binPath= c:\\temp\\mr.exe);

i got that working thanks but now fell into another problem, this was just half of command,
full command i wanted to run was


"sc.exe", "create myservice start auto binPath = c:\\temp\\mr.exe obj= ./scvadmin Displayname= "My service" password= Password1

now i can not pass ./scvadmin also "My Service" need to be in side "".
sorry for dumb question but i m just stuck on here....

wasim21k
04-07-2009, 04:26 AM
i think i can answer my question here
that .\administrator part
it needs .\\administrator

but now stuck with ""

reteset
04-07-2009, 05:04 AM
i think it should be like this

Displayname= \"My service\"
"sc.exe", "create myservice start auto binPath = c:\\temp\\mr.exe obj= ./scvadmin Displayname= \"My service\" password= Password1"

Stefan_M
04-08-2009, 05:27 AM
if you need " inside the string, change the outer " to '

"sc.exe", "create myservice start auto binPath = c:\\temp\\mr.exe obj= ./scvadmin Displayname= \"My service\" password= Password1"

"sc.exe", 'create myservice start auto binPath = c:\\temp\\mr.exe obj= ./scvadmin Displayname= \"My service\" password= Password1'

wasim21k
04-10-2009, 10:21 AM
thanx every one problem solved