 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Deller
Joined: 21 Nov 2007 Posts: 214 Location: 0x01101110
|
Posted: Sat Nov 24, 2007 12:15 am Post subject: dos commands build into ahk |
|
|
| AHK should have all dos commands (not too many of them around) built into it. |
|
| Back to top |
|
 |
tic
Joined: 22 Apr 2007 Posts: 1375
|
Posted: Sat Nov 24, 2007 12:17 am Post subject: |
|
|
| which one doesnt it have that you would need? |
|
| Back to top |
|
 |
Deller
Joined: 21 Nov 2007 Posts: 214 Location: 0x01101110
|
Posted: Sat Nov 24, 2007 2:18 am Post subject: |
|
|
all the net commands as in
net user
net view
net send
net use |
|
| Back to top |
|
 |
garry
Joined: 19 Apr 2005 Posts: 1186 Location: switzerland
|
Posted: Sat Nov 24, 2007 9:54 am Post subject: |
|
|
has many commands like filedelete/copy/recycle filemovedir ...etc which can used in loop
or use dos command in ahk
run,%comspec% /k %mycmd%
runwait,%comspec% /c %mycmd% >test.txt,,hide ;hidden |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 2739 Location: Australia, Qld
|
Posted: Sat Nov 24, 2007 10:00 am Post subject: |
|
|
Windows NT-based systems (2000, XP, 2003, Vista) do not use DOS. "Net" is a console application that comes with Windows. You can run it like any other Windows application:
...or the more useful:
| Code: | | Run, %comspec% /k net /? |
I tried piping the output of net /? (as in garry's example), but it seemed to create an empty file every time.
For a description of /k and /c:
|
|
| Back to top |
|
 |
garry
Joined: 19 Apr 2005 Posts: 1186 Location: switzerland
|
Posted: Sat Nov 24, 2007 10:57 am Post subject: |
|
|
hello lexikos,
piping not always work, maybe use cmdret
here an example copies DOS window
| Code: | DetectHiddenWindows On
mycmd =netstat -e -s
;mycmd = net /? ;this command see only in DOS window
srch =send ;this search for "send"
F3 =%temp%\DOS_SEARCHED_TEXT.txt ;only searched string shows in editbox
F4 =%temp%\DOS_PIPE.txt ;the DOS command output (pipe) not always show all
F5 =%temp%\DOS_WINDOW_READED.txt ;read from DOS command window clipboard
Gui,2:Font,,FixedSys
Gui,2:Add,Listbox, x10 y5 h190 w740 vLB1,
Gui,2:Add,button, x20 y200 h20 w100 gSTART,START
Gui,2:Add,button, x340 y220 h20 w100 gCLEAR,CLEAR
Gui,2:Add,Edit, x140 y200 h20 w300 vMyCMD ,%mycmd%
Gui,2:Add, Button, x0 y0 w0 h0 default gSTART1,
Gui,2:Add,Text, x460 y200 ,Search for:
Gui,2:Add,Edit, x560 y200 h20 w180 vSrch,%srch%
Gui,2:Add,Text, x15 y230 ,DOS-PIPE:
Gui,2:Add,Listbox, x10 y250 h190 w740 vLB2,
Gui,2:Add,Text, x15 y450 ,DOS WINDOW COPIED:
Gui,2:Add,Listbox, x10 y470 h190 w740 vLB3,
Gui,2:Show, x0 y0 h680 w760 , Searched string= %srch% for= %mycmd%
GuiControl,2:Focus,MyCMD
return
;-------------------------------------------------------
CLEAR:
Guicontrol,2:,mycmd,
Guicontrol,2:,srch,
GuiControl,2:,LB1,|
GuiControl,2:,LB2,|
GuiControl,2:,LB3,|
return
START1:
START:
Gui,2:submit,nohide
ifexist,%F5%
filedelete,%F5%
GuiControl,2:,LB1,| ;clear listbox1
GuiControl,2:,LB2,| ;clear listbox2
GuiControl,2:,LB3,| ;clear listbox3
runwait,%comspec% /c %mycmd% |find /I "%srch%" >%F3%,,hide ;shows only lines with found string
runwait,%comspec% /c %mycmd% |find /V "XXXBBB" >%F4%,,hide ;shows (most) always all
;runwait,%comspec% /k %mycmd% ; see DOS
run,%comspec% /k %myCmd%,,hide,PID ;must be run and parameter k
WinWait %ComSpec% ahk_pid %PID%
WinActivate ahk_pid %PID%
sleep,1000
ClipBoard =
SendInput !{Space}es{Enter} ; select/copy DOS english
;SendInput !{Space}ba{Enter} ; select/copy DOS german
ClipWait 2
process,close,%PID% ;closes DOS /k
Fileappend,%ClipBoard%,%F5%
Loop,read,%F3%
GuiControl,2:,LB1,%A_LoopReadLine% ;listbox shows only lines with found words
Loop,read,%F4%
GuiControl,2:,LB2,%A_LoopReadLine% ;listbox shows (most) all
Loop,read,%F5%
GuiControl,2:,LB3,%A_LoopReadLine% ;listbox shows all, copy from DOS WINDOW
return
|
|
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|