AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

running batch files

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Yanah
Guest





PostPosted: Mon Nov 27, 2006 9:43 pm    Post subject: running batch files Reply with quote

Ok, if I've got a .bat file for-instance at c:\runonce.bat..... how in AHK, can I issue a command to Windows to run that file after re-booting? -~Y
Back to top
Tuncay



Joined: 07 Nov 2006
Posts: 384
Location: Berlin

PostPosted: Mon Nov 27, 2006 10:16 pm    Post subject: Reply with quote

Create an AutoHotkey script, say for example run_runonce.bat.ahk and put it in your AutoStart folder of Windows.
Code:
Run, "c:\runonce.bat", c:\

If you want hide the command line window:
Code:
Run, "c:\runonce.bat", c:\, hide

Look at the help file for more informations about Run command in AutoHotkey.
Back to top
View user's profile Send private message Send e-mail
Yanah
Guest





PostPosted: Mon Nov 27, 2006 11:23 pm    Post subject: Reply with quote

Hi Tuncay, Smile Very Happy Is there anyway to do this other than placing a file in a fixed location?
Back to top
Tuncay



Joined: 07 Nov 2006
Posts: 384
Location: Berlin

PostPosted: Mon Nov 27, 2006 11:46 pm    Post subject: Reply with quote

Which file do you mean, the ahk script or the batch file? Where would you like to put the files? May be on a USB stick?
Back to top
View user's profile Send private message Send e-mail
AgentSmith15



Joined: 06 May 2005
Posts: 37

PostPosted: Thu Aug 02, 2007 6:38 am    Post subject: Reply with quote

I think Yanah is/was on a role.
Does anyone know of a way to run batch commands from within a AHK script?
Back to top
View user's profile Send private message
garry



Joined: 19 Apr 2005
Posts: 1028
Location: switzerland

PostPosted: Thu Aug 02, 2007 10:38 am    Post subject: Reply with quote

Code:
RU3=C:\TEST
ifnotexist,%RU3%
FileCreateDir,%RU3%                      ;creates a folder c:\test

F1=%RU3%\b.bat                            ;filename
SplitPath,F1,name, dir, ext, name_no_ext, drive
filedelete,%F1%                           ;delete file b.bat
fileappend,dir c:\windows /s,%F1%         ;creates b.bat with command dir c:\windows /s
SplitPath,F1,name, dir2, ext, name_no_ext, drive
msgbox,%DIR2%                             ;this a the workingdir
;Run, Target [, WorkingDir, Max|Min|Hide|UseErrorLevel, OutputVarPID]
;runwait,c:\test\b.bat, c:\test\, hide    ;hidden
;run,%comspec% /K %F1%,%RU3%              ;start DOS command b.bat with workingdir
run,%comspec% /K %F1%,%DIR2%              ;start DOS command b.bat with workingdir
exitapp
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group