%ComSpec% is not working on AnyDesk/TeamViewer

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
vikasgandhi
Posts: 31
Joined: 03 Jul 2021, 20:28

%ComSpec% is not working on AnyDesk/TeamViewer

Post by vikasgandhi » 25 Mar 2023, 08:27

Please help, the command %ComSpec% is not working on AnyDesk/Team Viewer

Code: Select all

^k::
Run, *runas %ComSpec%

User avatar
mikeyww
Posts: 26437
Joined: 09 Sep 2014, 18:38

Re: %ComSpec% is not working on AnyDesk/TeamViewer

Post by mikeyww » 25 Mar 2023, 09:10

Hello,

I did not try it, but in some situations, admin mode is needed, or running the script on the remote host.

vikasgandhi
Posts: 31
Joined: 03 Jul 2021, 20:28

Re: %ComSpec% is not working on AnyDesk/TeamViewer

Post by vikasgandhi » 25 Mar 2023, 09:34

You are right we can't get resolve it, without having 2pc (host & client), admin command attached

Code: Select all

#SingleInstance Force
SetWorkingDir %A_ScriptDir%
if not A_IsAdmin
	Run *RunAs "%A_ScriptFullPath%" ; (A_AhkPath is usually optional if the script has the .ahk extension.) You would typically check  first.



^k::
Run, *runas %ComSpec%
return

User avatar
boiler
Posts: 16705
Joined: 21 Dec 2014, 02:44

Re: %ComSpec% is not working on AnyDesk/TeamViewer

Post by boiler » 25 Mar 2023, 09:57

@vikasgandhi — Please don’t put original text in quote tags. What reason would there be to do that?

vikasgandhi
Posts: 31
Joined: 03 Jul 2021, 20:28

Re: %ComSpec% is not working on AnyDesk/TeamViewer

Post by vikasgandhi » 25 Mar 2023, 10:54

I'm sorry, mistake due to ignorance of rules, I will take care of it in future

User avatar
mikeyww
Posts: 26437
Joined: 09 Sep 2014, 18:38

Re: %ComSpec% is not working on AnyDesk/TeamViewer

Post by mikeyww » 25 Mar 2023, 10:58

I'm not sure why you would need the same script at each end, but if it works, use it!

vikasgandhi
Posts: 31
Joined: 03 Jul 2021, 20:28

Re: %ComSpec% is not working on AnyDesk/TeamViewer

Post by vikasgandhi » 25 Mar 2023, 13:59

With the help of this command, I open the "Elevated Command Prompt" window in the client's system.
we use TeamViewer / AnyDesk, to access client PC.
But the mentioned "Command" (^k::) is not open "Elevated Command Prompt" at client's PC(System)

User avatar
mikeyww
Posts: 26437
Joined: 09 Sep 2014, 18:38

Re: %ComSpec% is not working on AnyDesk/TeamViewer

Post by mikeyww » 25 Mar 2023, 15:34

Those are my only ideas for you. Best of luck!

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: %ComSpec% is not working on AnyDesk/TeamViewer

Post by swagfag » 25 Mar 2023, 16:28

if the ahk script is running on YOUR machine, then obviously u wont be able to Run anything on the REMOTE machine
if the ahk script is running on the REMOTE machine, check first if the hotkey is even being triggered at all. then shove Run inside a try-catch block and see what exception is thrown(assuming its failing at all to begin with)

vikasgandhi
Posts: 31
Joined: 03 Jul 2021, 20:28

Re: %ComSpec% is not working on AnyDesk/TeamViewer

Post by vikasgandhi » 25 Mar 2023, 22:58

Thanks for reply !!!

We show two different type of commands, first command works on customer's pc(Via Anydesk/TeamViewer) but the second command is not working on customer's pc(Via AnyDesk/TeamViewer) we have to fix the second one, thanks !!!

---------------------
Command/Script :1
---------------------
Note: "Works on Clients PC (via Anydesk/Team Viewer)"

Code: Select all

#i::
Run, https://www.google.com/
return
---------------------
Command/Script :2
---------------------
Note: "Doesn't Work on Clients PC (via Anydesk/Team Viewer)"

Code: Select all

#SingleInstance Force
SetWorkingDir `%A_ScriptDir`%
if not A_IsAdmin
	Run *RunAs "%A_ScriptFullPath%" ; (A_AhkPath is usually optional if the script has the .ahk extension.) You would typically check  first.

^t::
Run, *runas %ComSpec%
return
Best Regards
Vikas

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: %ComSpec% is not working on AnyDesk/TeamViewer

Post by swagfag » 26 Mar 2023, 02:17

like i said
swagfag wrote:
25 Mar 2023, 16:28
...
if the ahk script is running on the REMOTE machine, check first if the hotkey is even being triggered at all. ...
put a msgbox in or something

vikasgandhi
Posts: 31
Joined: 03 Jul 2021, 20:28

Re: %ComSpec% is not working on AnyDesk/TeamViewer

Post by vikasgandhi » 26 Mar 2023, 03:13

swagfag wrote:
26 Mar 2023, 02:17
like i said
swagfag wrote:
25 Mar 2023, 16:28
...
if the ahk script is running on the REMOTE machine, check first if the hotkey is even being triggered at all. ...
put a msgbox in or something
The script is installed on my PC, it is running well on my PC, but it is not running on client PC (via AnyDesk/TeamViewer),
(Actually it must run on client's PC, when we support to him/her.)

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: %ComSpec% is not working on AnyDesk/TeamViewer

Post by swagfag » 26 Mar 2023, 10:01

:crazy: ok, then let me rephrase it again
swagfag wrote:
25 Mar 2023, 16:28
if the ahk script is runningis an ahk file that is physically present on YOUR machine and that ahk script file has been launched by an ahk interpreter (AutoHotkey(A32|U32|U64)?\.exe) that is also physically present on YOUR machine, then obviously u wont be able to Run anything on the REMOTE machine

if the ahk script is runningis an ahk file that is physically present on the REMOTE machine and that ahk script file has been launched by an ahk interpreter (AutoHotkey(A32|U32|U64)?\.exe) that is also physically present on that REMOTE machine, check first if the hotkey is even being triggered at all. if the hotkey's subroutine is being triggered, however Run is failing(for whateeeeeeeeever reasons), then shove that Run command inside a try-catch block and see what exception is thrown. then u would know what problem to troubleshoot next

vikasgandhi
Posts: 31
Joined: 03 Jul 2021, 20:28

Re: %ComSpec% is not working on AnyDesk/TeamViewer

Post by vikasgandhi » 28 Mar 2023, 06:22

Hello Forum,
I need forum help, a script has been created, which is not working, on AnyDesk/TeamViewer,
The function of the script is, to open the "Elevated Command Prompt" window, with the help of AutoHotKey, when we access the customer's pc(computer) from AnyDesk, this script will not work.

Code: Select all

#SingleInstance Force
SetWorkingDir %A_ScriptDir%
if not A_IsAdmin
	Run *RunAs "%A_ScriptFullPath%" ; (A_AhkPath is usually optional if the script has the .ahk extension.) You would typically check  first.



^l::
Run, *runas %ComSpec%
return

User avatar
boiler
Posts: 16705
Joined: 21 Dec 2014, 02:44

Re: %ComSpec% is not working on AnyDesk/TeamViewer

Post by boiler » 28 Mar 2023, 08:56

vikasgandhi wrote: I need forum help, a script has been created, which is not working, on AnyDesk/TeamViewer,
The function of the script is, to open the "Elevated Command Prompt" window, with the help of AutoHotKey, when we access the customer's pc(computer) from AnyDesk, this script will not work.
Please do not post the same question in multiple threads. Thank you. I will let the new thread stand.

vikasgandhi
Posts: 31
Joined: 03 Jul 2021, 20:28

Re: %ComSpec% is not working on AnyDesk/TeamViewer

Post by vikasgandhi » 28 Mar 2023, 09:27

Hello,
I am happy to hear that you are seriously helping me.
To explain the problem, I make an attempt again, so that we can understand the issue well and get a solution for it : -


I am sharing a script with you guys
What is script?
The script is simple, it opens an "Elevated Command Prompt" window when "Cntrl + L" is pressed.

This script is built in version "AutoHotkey_1.1.36.02" and is a very simple script

If you install this script in your system it works great.

But when you try to run this script on the client system with the help of "Anydesk" or "Team Viewer", it does not run on the client system, but it runs on your own system, but not on the client's PC.

Running it on the client PC/system, which we accessed with the help of "AnyDesk or TeamViewer" is the solution we are seeking.

Code: Select all

#SingleInstance Force
SetWorkingDir %A_ScriptDir%
if not A_IsAdmin
	Run *RunAs "%A_ScriptFullPath%" ; (A_AhkPath is usually optional if the script has the .ahk extension.) You would typically check  first.



^l::
Run, *runas %ComSpec%
return

vikasgandhi
Posts: 31
Joined: 03 Jul 2021, 20:28

Re: %ComSpec% is not working on AnyDesk/TeamViewer

Post by vikasgandhi » 28 Mar 2023, 09:28

mikeyww wrote:
25 Mar 2023, 10:58
I'm not sure why you would need the same script at each end, but if it works, use it!
Hello,
I am happy to hear that you are seriously helping me.
To explain the problem, I make an attempt again, so that we can understand the issue well and get a solution for it : -


I am sharing a script with you guys
What is script?
The script is simple, it opens an "Elevated Command Prompt" window when "Cntrl + L" is pressed.

This script is built in version "AutoHotkey_1.1.36.02" and is a very simple script

If you install this script in your system it works great.

But when you try to run this script on the client system with the help of "Anydesk" or "Team Viewer", it does not run on the client system, but it runs on your own system, but not on the client's PC.

Running it on the client PC/system, which we accessed with the help of "AnyDesk or TeamViewer" is the solution we are seeking.

Code: Select all

#SingleInstance Force
SetWorkingDir %A_ScriptDir%
if not A_IsAdmin
	Run *RunAs "%A_ScriptFullPath%" ; (A_AhkPath is usually optional if the script has the .ahk extension.) You would typically check  first.



^l::
Run, *runas %ComSpec%
return

vikasgandhi
Posts: 31
Joined: 03 Jul 2021, 20:28

Re: %ComSpec% is not working on AnyDesk/TeamViewer

Post by vikasgandhi » 28 Mar 2023, 10:12

mikeyww wrote:
25 Mar 2023, 10:58
I'm not sure why you would need the same script at each end, but if it works, use it!
I am a freelancer and provide support to my clients.
Because I support clients from home, for which I take the help of AnyDesk or TeamViewer
To support any client, the first step begins by opening the "Elevated Command Prompt" window.

I am a freelancer and provide support to my clients.
Because I support clients from home, for which I take the help of AnyDesk or TeamViewer
To support any client, the first step begins by opening the "Elevated Command Prompt" window.

To simplify the process (One Key Touch) of opening"Elevated Command Prompt" Windows, I see potential in AutoHotKey,
So the invaluable help of you veterans is desperately needed

User avatar
mikeyww
Posts: 26437
Joined: 09 Sep 2014, 18:38

Re: %ComSpec% is not working on AnyDesk/TeamViewer

Post by mikeyww » 28 Mar 2023, 10:19

OK. You have convinced me that you are a freelancer and provide support to your clients. :)

It looks like swagfag probably has the secret sauce here, so I defer to swagfag's experience & recommendations on this topic.

vikasgandhi
Posts: 31
Joined: 03 Jul 2021, 20:28

Re: %ComSpec% is not working on AnyDesk/TeamViewer

Post by vikasgandhi » 28 Mar 2023, 10:25

mikeyww wrote:
28 Mar 2023, 10:19
OK. You have convinced me that you are a freelancer and provide support to your clients. :)

It looks like swagfag probably has the secret sauce here, so I defer to swagfag's experience & recommendations on this topic.
what you say is good but i am not getting the solution

Post Reply

Return to “Ask for Help (v1)”