Opposite of CMD TASKKILL?

Smoblikat

Diamond Member
Nov 19, 2011
5,184
107
106
I am doing some coding and found out that in CMD you can permanently kill any process by using the TASKKILL command, I am just wondering if there is a similar command called TASKSTART or whatever. The reason I like this command is because it lets me run (in this case, close) a program with different credentials. The idea here is to start a program with administrative credentials.
 

Smoblikat

Diamond Member
Nov 19, 2011
5,184
107
106
Code:
runas /u:domain\admin "c:\some dir\some prog\herewego.exe"

PERFECT, thank you!

Just to make sure I have the syntax right:

Code:
runas /my_username:my_domain\admin "c:\some dir\some prog\herewego.exe"

How do I input the password to authenticate against the domain?
 

Tweak155

Lifer
Sep 23, 2003
11,448
262
126
PERFECT, thank you!

Just to make sure I have the syntax right:

Code:
runas /my_username:my_domain\admin "c:\some dir\some prog\herewego.exe"

How do I input the password to authenticate against the domain?

So your syntax can be either:

Code:
runas /user:my_domain\my_login_name "c:\some dir\some prog\herewego.exe"

Or

Code:
runas /u:my_domain\my_login_name "c:\some dir\some prog\herewego.exe"

Where my_login_name can be admin or any other username.

You can't force in the password, it has to prompt and then you type it in.

Are these remote executions or local?
 

Smoblikat

Diamond Member
Nov 19, 2011
5,184
107
106
So your syntax can be either:

Code:
runas /user:my_domain\my_login_name "c:\some dir\some prog\herewego.exe"
Or

Code:
runas /u:my_domain\my_login_name "c:\some dir\some prog\herewego.exe"
Where my_login_name can be admin or any other username.

You can't force in the password, it has to prompt and then you type it in.

Are these remote executions or local?

Thank you, these will be local executions.
 

Tweak155

Lifer
Sep 23, 2003
11,448
262
126
Thank you, these will be local executions.

If you want, you can download a tool purchased by Microsoft a long while back. Its purpose was to remotely execute programs using any specified credentials, but I believe it allows you to do local machines as well.

The problem is - if its local, you have to have PSEXEC on all the stations.

See: http://ss64.com/nt/psexec.html
 

Smoblikat

Diamond Member
Nov 19, 2011
5,184
107
106
Im trying to launch internet explorer, but when I run the code it doesnt work (just brings up the help commands)

My syntax is:
Runas /profile /env /user:domain.com\admusername C:\Program Files\Internet Explorer\IEXPLORER.exe

If I run the code without the C:\program.... and just put NOTEPAD.exe, it works fine. So I am thinking the issue is the directory path, do I need to put quotations around it? I am programming this in VB, so if so, how do I make a string include quotations as part of the string, instead of trying to start a new string?
 

Smoblikat

Diamond Member
Nov 19, 2011
5,184
107
106
If you want, you can download a tool purchased by Microsoft a long while back. Its purpose was to remotely execute programs using any specified credentials, but I believe it allows you to do local machines as well.

The problem is - if its local, you have to have PSEXEC on all the stations.

See: http://ss64.com/nt/psexec.html

Hmmmm, I would like to keep this as native as possible and dont really want a program running in the background.
 

Tweak155

Lifer
Sep 23, 2003
11,448
262
126
Im trying to launch internet explorer, but when I run the code it doesnt work (just brings up the help commands)

My syntax is:
Runas /profile /env /user:domain.com\admusername C:\Program Files\Internet Explorer\IEXPLORER.exe

If I run the code without the C:\program.... and just put NOTEPAD.exe, it works fine. So I am thinking the issue is the directory path, do I need to put quotations around it? I am programming this in VB, so if so, how do I make a string include quotations as part of the string, instead of trying to start a new string?

What does your line in VB look like?

I think you'll need something like this "runas.......... ""C:\space in\my dir\file.exe"""
 

Tweak155

Lifer
Sep 23, 2003
11,448
262
126
Hmmmm, I would like to keep this as native as possible and dont really want a program running in the background.

You can choose to just launch and close. By default it will wait for whatever task it kicked off to complete, but there is a parameter to just kick it off and don't wait.
 

Ichinisan

Lifer
Oct 9, 2002
28,298
1,235
136
I was always a VB novice, but I used to pull of quotes in strings with something like:

Chr(34) + "C:\Program Files\blahblah\blah.exe" + Chr(34)

I probably could have done something like this instead:

vbQuote + "C:\Program Files\blahblah\blah.exe" + vbQuote

OR

""C:\Program Files\blahblah\blah.exe""