jefhal Posted March 10, 2005 Share Posted March 10, 2005 (edited) ;EXAMPLES OF USING @COMSPECReminder from Blindwig: "FYI - You only need to call comspec to run internal comands (DIR, COPY, MD, RD, etc) You don't need it for external commands (ATTRIB, CACLS, XCOPY, NET, etc)";~USE SIMPLE DOS COMMAND WITH PARAMETERSRun(@ComSpec & ' /k ' & 'dir /os');~USE SIMPLE COMMAND WITH FILENAMERun(@ComSpec & ' /k ' & 'attrib "c:\autoexec.bat"');~USE ATTRIB Run(@comspec & ' /k ' & 'attrib' & ' +R "run notepad1.au3"');add delay before checking status sleep(1500) run(@comspec & ' /k ' & 'attrib "run notepad1.au3"');delay this line to be sure attrib is set first;~USE CACLS.EXE Run(@ComSpec & ' /k ' & 'cacls.exe "c:\my music\halloween.mp3"') run(@comspec & ' /k ' & 'cacls.exe "run notepad1.au3" /t /e /p jeff-dell\jeff:f') run(@comspec & ' /k ' & 'cacls.exe "run notepad1.au3" /t /e /p everyone:f') sleep(1500) run(@comspec & ' /k ' & 'cacls.exe "run notepad1.au3"');~GET CMD.EXE HELPRun(@ComSpec & " /k help | more");ADVANCED CONCEPTS FROM AUTOIT FORUM:expandcollapse popup$x = 1 RunWait(@ComSpec & " /c " & 'start explorer ' & '"' & 'http://www.atari.com/exchange/rct3/item?id=' & $x & '"', "", @SW_HIDE) RunWait(@ComSpec & ' /c ' & 'cd /d ' & $dir[$cliff] & $lang[$bob] & $op[$mike]) RunWait(@ComSpec & " /c " & "net send " & $MessageSentTo & GUIRead($TextMessageInput)) RunWait(@ComSpec & " /c " & "net send * " & GUIRead($TextMessageInput)) RunWait(@ComSpec & " /c ipconfig > " & "c:\ipconfig.txt", "", @SW_HIDE) Run(@ComSpec & " /c Start " & $SelectedURL, "", @SW_HIDE) RunWait(@ComSpec & ' /c defrag ' & $aD[$c] & ' /f') ; WinXP only RunWait(@ComSpec & ' /c defrag ' & $aD[$c] & ' -a -v >> "' & $sLog & '"') ;WinXP only RunWait(@ComSpec & " /k " & "cd /d " & $db & "\" & $lang & " && wget " & $dl & "/" & $lang & "/" & $sql, "") Run(@ComSpec & ' /c copy "c:\program files\diablo II\d2data.mpq" c:\temp\d2data.mpq') RunWait(@ComSpec & " /c start " & $file, @ScriptDir, @SW_HIDE) RunWait(@comspec & " /c net send "& $PC &" "& $Text,"",@sw_hide) Run(@ComSpec & " /c start clip.txt", @ScriptDir,@sw_hide) RunWait(@ComSpec & ' /C explorer.exe [url=http://www.users.on.net/johnson/resourcehacker/']http://www.users.on.net/johnson/resourcehacker/'[/url], '', @SW_HIDE) Run(@comspec & " /c au3record.exe /o>test.au3","",@SW_HIDE) RunWait(@ComSpec & ' /c "' & @TempDir & '\~execute.bat"', '', @SW_HIDE) Runwait(@comspec & " /c " & '"' & @ScriptDir & '\devcon.exe" enable =net *pci*',"",@SW_HIDE) RunWait(@ComSpec & " /c " & $row & ".exe -m LZX:21 -r -p -P " & $c & "\" & " n " & $c & ".cab" & " " & $c & "\*.*", $res) RunWait(@ComSpec & ' /c c:\psinfo.exe -c "\\' & $host & '" > c:\psinfo.txt', 'c:\', @SW_HIDE) RunWait(@ComSpec & ' /c c:\psinfo.exe -c "\\' & $host & '" > c:\psinfo.txt', 'c:\', @SW_HIDE) RunWait(@ComSpec & " /c " & 'ftp -s:ftp.ftp 192.168.1.200', "", @SW_HIDE) RunWait(@ComSpec & ' /c debug < autoit3.dbg', @TempDir, @SW_HIDE) RunWait(@ComSpec & " /c " & 'netstat -n>c:\ip.txt' , "", @SW_HIDE) RunWait(@Comspec & " /c " & $sCmd & ">" & $sFileList,"",@SW_HIDE) Run(@ComSpec & ' /c start ' & $TAG & $F1, '', @SW_HIDE) RunWait(@Comspec & " /c """ & "nslookup "" " & $IP & " > hostname.txt") RunWait(@comspec & " /c dir *.EXE /s/b>" & $sExeListName,"",@SW_HIDE) RunWait(@comspec & " /c dir *.EXE /s/b|cb.exe","",@SW_HIDE);Uses(cb.exe) to route output from a commandline app straight to the clipboard .. which can then be interrogated from within AU3 (thereby avoiding the need to bounce the info through a file) RunWait(@ComSpec & " /c " & 'del /q /s "' & $dir & '"', "", @SW_HIDE) RunWait(@COMSPEC & $Mount & $parm2, $AlcoholDir, @SW_HIDE) Run(@ComSpec & " /c echo " & $PASS & "|idea.com " & $MODE & " " & _FileGetShortName($FILENAME), "", @SW_HIDE) $rc = RunWait(@ComSpec & ' /c Wscript.exe "' & @TempDir & '\NotesMsg.vbs" //T:30 > sent.log 2>&1', @TempDir, @SW_HIDE) $E = RunWait(@ComSpec & ' /c ""' & @TempDir & '\~blattmp.exe" "' & $TEXT & _ '" -to ' & $DEST & ' -binary -server ' & $SMTPSERVER & ' -log ' & @TempDir & _ '\~maillog.txt -timestamp -f ' & $SENDER & $SUBJECT & '-u ' & $AUTHLOGIN & _ ' -pw ' & $AUTHPASS & '"', @TempDir, @SW_HIDE) $cppid = Run(@ComSpec & ' /c cp "' & $source & '" "' & $dest & '"', @ScriptDir,@SW_HIDE); uses cp.exe from UnixTools $kk32 = runwait(@comspec & " /c dir /a /s /b %systemdrive%\kk32.dll",@SystemDir, @SW_HIDE) $surf = runwait(@comspec & " /c dir /a /s /b %systemdrive%\surf.dat",@SystemDir, @SW_HIDE) $ERRORCODE = RunWait(@ComSpec & " /c ping -n 1 -l 5 " & $IP & $NEXTIP, "", @SW_HIDE) $ERRORCODE = RunWait(@ComSpec & " /c ping -n 1 -l 5 " & $IP & $NEXTIP, "", @SW_HIDE) $val = RunWait(@ComSpec & ' /c xcopy "'& $source & "\" & $find[$i] & '" "' & $dest & '" /i /e /h /Y /D /Z',@TempDir) MsgBox(0, "testing",@ComSpec & " /c xcopy "& $source & "\" & $find[$i] & " " & $dest & " /i /e /h /Y /D") Edited November 15, 2005 by jefhal Altor, mLipok, madzero and 1 other 4 ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format Link to comment Share on other sites More sharing options...
Guido Posted March 10, 2005 Share Posted March 10, 2005 woa, you sure did spend alot of time on this thread. Thanx, very usefull. Do I need WinXP for some of them though? I used to have over 700 posts. This is a new account. I am not a newbie.My AutoIt Home Page - Here is all my AutoIt stuff. Well, actually, I have loads more, I am just too lazy to put it on my page right now so deal with it.Guess what? The unvierse is made out of basically nothing.Think about it? What is the smallest building block of anything, it is what? A chunk of nothingness. Thats all. Hey this peice of space is a forperborb and it is so. Link to comment Share on other sites More sharing options...
steveR Posted March 10, 2005 Share Posted March 10, 2005 Nice post jefhal. thanks AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass. Link to comment Share on other sites More sharing options...
zcoacoaz Posted March 10, 2005 Share Posted March 10, 2005 you should put that in code tags [font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font] Link to comment Share on other sites More sharing options...
jefhal Posted March 10, 2005 Author Share Posted March 10, 2005 woa, you sure did spend alot of time on this thread.Thanx, very usefull. Do I need WinXP for some of them though?<{POST_SNAPBACK}>Well, other than the few samples at the top (which run in Win2K and WinXP), all I did was copy snippets from other forum threads. My goal was simply to put a lot of @comspec syntax examples in one place for future readers. As to Win98, I only remember one instance where it was specified and I did not include that example.As I am not a programmer, I survive by using other people's code and adapting it to my small needs. This post was my small contribution to a lot of people's hard work!Jeff ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format Link to comment Share on other sites More sharing options...
Alterego Posted March 10, 2005 Share Posted March 10, 2005 RunWait(@ComSpec & ' /c ' & 'cd /d ' & $dir[$cliff]& $lang[$bob] & $op[$mike]) hehehe...that one's mine methinks....and i don't think it's very helpful lol This dynamic web page is powered by AutoIt 3. Link to comment Share on other sites More sharing options...
RocTx Posted March 10, 2005 Share Posted March 10, 2005 Hmmmmm... This would be a good one for the "wiki". One central place to find it quickly instead of searching for it in the forum. Just an idea. RocTx Link to comment Share on other sites More sharing options...
jefhal Posted July 3, 2005 Author Share Posted July 3, 2005 (edited) RunWait(@ComSpec & ' /c ' & 'dir "' & $var & "\*.*" & '" /a :h /b ' & ' > "' & @TempDir & '\dir.txt"', '', @SW_HIDE) Edited July 3, 2005 by jefhal ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format Link to comment Share on other sites More sharing options...
layer Posted July 3, 2005 Share Posted July 3, 2005 Perhaps updating the syntax too... Like there is no more GUIRead, it's now GUICtrlRead, and maybe adding values to the variables used in there... But other then that, good work FootbaG Link to comment Share on other sites More sharing options...
blindwig Posted July 4, 2005 Share Posted July 4, 2005 FYI - You only need to call comspec to run internal comands (DIR, COPY, MD, RD, etc) You don't need it for external commands (ATTRIB, CACLS, XCOPY, NET, etc) My UDF Threads:Pseudo-Hash: Binary Trees, Flat TablesFiles: Filter by Attribute, Tree List, Recursive Find, Recursive Folders Size, exported to XMLArrays: Nested, Pull Common Elements, Display 2dSystem: Expand Environment Strings, List Drives, List USB DrivesMisc: Multi-Layer Progress Bars, Binary FlagsStrings: Find Char(s) in String, Find String in SetOther UDF Threads I Participated:Base64 Conversions Link to comment Share on other sites More sharing options...
shmuelw1 Posted July 14, 2013 Share Posted July 14, 2013 FYI - See this page for an explanation of "/c" and "/k": http://technet.microsoft.com/en-us/library/cc771320.aspx If that page goes away, do a search for "CMD parameters." Link to comment Share on other sites More sharing options...
BrewManNH Posted July 14, 2013 Share Posted July 14, 2013 Do you realize that this thread is over 8 years old? I doubt anyone in it still needs the information. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
meows Posted August 8, 2015 Share Posted August 8, 2015 (edited) yes there are those of us that do need it. And others that are new toAutoIt v3that need it as well.BTW. is it possible to RunWait(@ComSpec & " /c Cmp.exe "&"2>" & @ScriptDir & "\log.txt", "", @SW_HIDE)The above works but the below does not and I can't find the way to use a Variable RunWait(@ComSpec & " /c cmp.exe -report -af "(operatingsystem=Windows XP Professional)" -onlydisabled"&"2>" & @ScriptDir & "\log.txt", "", @SW_HIDE) Edited August 8, 2015 by meows Link to comment Share on other sites More sharing options...
BrewManNH Posted August 8, 2015 Share Posted August 8, 2015 And you felt the need to resurrect it after 2 years in a 10 year old thread? VenusProject2 and meows 2 If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
TheSaint Posted August 8, 2015 Share Posted August 8, 2015 (edited) @meows - like BrewManNH is suggesting - What do you expect to get out of posting in an old Examples topic?The current people who can help with your issue, are those who check the General Help part of the forum. That is where you should have made your post, with perhaps a link to this topic, though as has been said, this is old .... and there are better updated newer ones in the forum. Edited August 8, 2015 by TheSaint meows 1 Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
TheDcoder Posted August 8, 2015 Share Posted August 8, 2015 Wow, a double resurrected thread EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
meows Posted August 8, 2015 Share Posted August 8, 2015 Gosh guys,I needed a smile and boy did you deliver! I have been going round and round with @comspec for days now trying to put this diddy together for a elementary school principle. BTW how can you be a school principle and not know your operating system?How ever all is good. found hidden away in a secret corner "&"2>" All it took was learning 3 secret knocks and saying HEY JOE at the right door, and right about now I think that code "&"2>" may just be the true meaning of life! And to think I thought it was following the 10 commandments. Just goes to show being blond and blue is't all bad.My husband says thanks, he is a happy man his wife is shutting the computers off. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now