Run cmd with parameters Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
zvit
Posts: 224
Joined: 07 Nov 2017, 06:15

Run cmd with parameters

Post by zvit » 05 Oct 2022, 08:07

I have a shortcut that opens a cmd with parameters. The shortcut's target is:

C:\Users\ztwer\System32\cmd.exe "/K" C:\Users\ztwer\anaconda3\Scripts\activate.bat C:\Users\ztwer\anaconda3

When running, the cmd window title should say "anaconda", like this:

Image

I am trying to run this with AHK. I have tried Run, %comspec% /c, and many other ways, but it's only opening the regular cmd, without "anaconda" like so:

Image

Here's my last attempt, please help me run this cmd command so that it opens correctly with the "anaconda," as it does when I click the shortcut.

Code: Select all

param= "/K" C:\Users\ztwer\anaconda3\Scripts\activate.bat C:\Users\ztwer\anaconda3
Run "C:\Windows\System32\cmd.exe" "%param%"

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

Re: Run cmd with parameters  Topic is solved

Post by mikeyww » 05 Oct 2022, 08:24

If you already have a working shortcut (LNK) file, you can use Run to run that shortcut.

User avatar
zvit
Posts: 224
Joined: 07 Nov 2017, 06:15

Re: Run cmd with parameters

Post by zvit » 05 Oct 2022, 08:27

The shortcut is just the regular cmd.exe. Without the parameters, it just opens the regular cmd window (not the anaconda one)

Image

User avatar
zvit
Posts: 224
Joined: 07 Nov 2017, 06:15

Re: Run cmd with parameters

Post by zvit » 05 Oct 2022, 08:40

I found a similar post here: https://stackoverflow.com/questions/64305524/autohotkey-run-program-as-admin-not-working

And using my Everything search, I found the real shortcuts, that when running them as you said, works great.
Thanks!

Image

Post Reply

Return to “Ask for Help (v1)”