How do I embed Windows batch file into ahk files? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
nutnutwin
Posts: 76
Joined: 28 Aug 2019, 07:25

How do I embed Windows batch file into ahk files?

13 May 2021, 02:10

Hi,

# Currently
I can

- Run/RunWait aaa\bbb\ccc\xxx.bat
- Or Use ComSpec to run single line batch as shown below

Code: Select all

	CMD_Run("start C:\")
	
	CMD_Run(User_CMD){
		Run, %ComSpec% /c %User_CMD%, ,  Hide
	}
# Question
I wonder if there is a way to run batch codes embedded into ahk?

I suppose it should look like

Code: Select all

	Local_String =
	(LTrim
	cd c:\
	delete a.txt
	pause
	}
	
	CMD_Run_MultiLines(Local_String)
# Why do I need this?
- calling external batch files make it a little difficult to manage source code
- as it require that the batch files path be maintained...
- I wish to keep calling bat by mistake(I use launcher like Everything to find scripts, and sometimes call the batch files by mistake)

Thank you
nutnutwin
Posts: 76
Joined: 28 Aug 2019, 07:25

Re: How do I embed Windows batch file into ahk files?

13 May 2021, 07:21

ahk7 wrote:
13 May 2021, 03:01
Perhaps example #7 https://www.autohotkey.com/docs/commands/Run.htm#StdOut
OMG how did I miss that
The examples are treasure!!!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: ccqcl, Descolada, mikeyww and 361 guests