Exe() - Script name = Executable name - Scripts and Functions - AutoHotkey Community

PHOTO EMBED

Fri Oct 21 2022 01:55:13 GMT+0000 (Coordinated Universal Time)

Saved by @aboltze123 #auto

Exe(file){
	Loop,%file%
		Filename:=RegExReplace(A_LoopFileShortName,"\.[^\.]*$")
	Loop,%A_AhkPath%
		path:=A_LoopFileDir
	FileMove,%A_AhkPath%,%path%\%FileName%.exe
	If ErrorLevel
		Return ErrorLevel
	Loop
		Loop,%path%\%FileName%.exe
		{
			Run %A_LoopFileFullPath% "%file%",% RegExReplace(file,"\\[^\\]*$"),,PID
			Process,Wait,%Pid%,5
			FileMove,%A_LoopFileFullPath%,%A_AhkPath%
			Process,Wait,%Pid%,0.1
			Return ErrorLevel
		}
}
content_copyCOPY

https://www.autohotkey.com/board/topic/38621-exe-script-name-executable-name/