Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Autohotkey script to open command prompt

I've collected a script from the AutoHotKey forum which lets me open a command prompt at the location I'm open in windows explorer. If the current window is not a explorer window then the prompt opens at the location where the script is present. I would like to change this behavior and make it open from C:\ if the current window is not a explorer window. I've tried to edit the script but its not working as desired.

#ifwinactive, ahk_class CabinetWClass
ControlGetText, address , edit1, ahk_class CabinetWClass
if (address <> "") {
Run, cmd.exe, %address%
}
else {
Run, cmd.exe, "C:"
}
ExitApp
#ifwinactive
like image 306
Soham Dasgupta Avatar asked Aug 09 '13 04:08

Soham Dasgupta


1 Answers

The command to run cmd.exe in the c:\ path is

run, cmd.exe, c:\

A full script that would run the cmd window every time would look like this

SetTitleMatchMode, 2
ifwinactive, ahk_class CabinetWClass
  ControlGetText, address , edit1, ahk_class CabinetWClass
else
  address =

; Exclude specific windows

ifwinactive, My Computer
  address =
ifwinactive, My Documents
  address =

if (address <> "") 
  Run, cmd.exe, %address%
else 
  Run, cmd.exe, C:\

ExitApp
like image 113
576i Avatar answered Sep 19 '22 12:09

576i