Author Topic: Run as different user  (Read 409 times)

Secondlaw

  • Newbie
  • *
  • Posts: 27
Run as different user
« on: January 02, 2019, 09:01:04 am »
Is there an easy way to run "CMD.EXE" with, "Run as different user" (see attached).

It seems that all of the info I'm able to find has "UAC" attached to it but that's not an issue for me. 

Thanks in advanced.

td

  • Tech Support
  • *****
  • Posts: 3020
    • WinBatch
Re: Run as different user
« Reply #1 on: January 02, 2019, 09:21:22 am »
You need to provide a lot more context.  Otherwise, you leave forum members to either post a response based on a guess at what that context might be or trying to answer the same question many times.   For example, do you want to create a WinBatch script to run cmd.exe as a different user?  Which version(s) of Windows are you planning to run cmd.exe on?  Why do you think UAC does not apply to you?
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

Secondlaw

  • Newbie
  • *
  • Posts: 27
Re: Run as different user
« Reply #2 on: January 02, 2019, 09:32:30 am »
"do you want to create a WinBatch script to run cmd.exe as a different user?"
Yes!

I'd like to run "CMD.EXE" as a different user on a 64bit Win10 machine.  I've turned off UAC.

td

  • Tech Support
  • *****
  • Posts: 3020
    • WinBatch
Re: Run as different user
« Reply #3 on: January 02, 2019, 11:59:47 am »
By "I've turned off UAC" do you mean you have set UAC to no admin prompt or do you mean you have edited the registry to completely disable UAC?  Note that if you have done the latter, you will not be able to run system apps like "Settings" and "Calculator" to name a few.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

td

  • Tech Support
  • *****
  • Posts: 3020
    • WinBatch
Re: Run as different user
« Reply #4 on: January 03, 2019, 08:04:33 am »
Should add that if you simply turned off UAC admin prompting on Windows 10, UAC considerations do apply to attempts to run as a different user.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

Secondlaw

  • Newbie
  • *
  • Posts: 27
Re: Run as different user
« Reply #5 on: January 04, 2019, 04:56:24 am »
I've edited the registry to turn it off.

Is there a way to do this or should I look for another solution?

td

  • Tech Support
  • *****
  • Posts: 3020
    • WinBatch
Re: Run as different user
« Reply #6 on: January 04, 2019, 07:51:51 am »
The RunWithLogon function is used to run an application as a different user.  Please see the Consolidated WIL Help file for details.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

Secondlaw

  • Newbie
  • *
  • Posts: 27
Re: Run as different user
« Reply #7 on: January 04, 2019, 08:10:37 am »
PERFECT!!!!  Thank You!

td

  • Tech Support
  • *****
  • Posts: 3020
    • WinBatch
Re: Run as different user
« Reply #8 on: January 10, 2019, 07:35:23 am »
In the future when you start a topic, please provide more context up front. 
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade