lazyass Posted March 12, 2012 Share Posted March 12, 2012 Hi guys! I'm having some trouble running a simple commandline through AutoIt. The line works when I just put it into a commandprompt or if I'm running it in a batch script, but nothing happens if I run it through an AutoIT script. No errors or anything... Any help is much appreciated. Thanks in advance. RunWait(@ComSpec & " /C " & "for /r I:\ %%x in (*.txt) do ren %x *.bak", "", @SW_HIDE) The batch script that I've got to work looks like this: @echo off for /r "I:\" %%x in (*.txt) do ren "%%x" *.bak exit Running AutoIt v3.3.6.1 Windows 7 Enterprise Edition SP1 64bit Link to comment Share on other sites More sharing options...
Exit Posted March 12, 2012 Share Posted March 12, 2012 (edited) Try this: RunWait(@ComSpec & ' /C ' & ' echo for /r "I:" %%x in (*.txt) do ren "%%x" "*.bak" >~.cmd && ~.cmd && del ~.cmd', "", @SW_HIDE) Edited March 12, 2012 by forumer100 App: Au3toCmd UDF: _SingleScript() Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted March 12, 2012 Moderators Share Posted March 12, 2012 Hi, lazyass, welcome to the forum. It appears from your batch file you're trying to rename a bunch of txt files to .bak. Why not do this purely through AutoIT, and skip the middleman? Notice I used the Desktop directory, as I have no I: drive mapped. $dir = @DesktopDir & "Test" FileMove($dir & "*.txt", $dir & "*.bak") "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
lazyass Posted March 12, 2012 Author Share Posted March 12, 2012 (edited) Thanks for the effort, forumer100 but it still won't work. Any other ideas? @JLogan3o13: I would like to do it purely within AutoIT, so I appreciate your advise. It works at the root of I: but I would like to do it recursively. Any ideas how to do that? Edited March 12, 2012 by lazyass Link to comment Share on other sites More sharing options...
Exit Posted March 12, 2012 Share Posted March 12, 2012 Thanks for the effort, forumer100 but it still won't work.Any other ideas?I edited my first post. RunWait(@ComSpec & ' /C ' & ' echo for /r "I:" %%x in (*.txt) do ren "%%x" "*.bak" >~.cmd && ~.cmd && del ~.cmd', "", @SW_HIDE) Does it work now? App: Au3toCmd UDF: _SingleScript() Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted March 12, 2012 Moderators Share Posted March 12, 2012 Hi, Lazyass. Just so I am clear on your intention, do you want to turn every .txt file on your I: drive to a .bak file? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
lazyass Posted March 12, 2012 Author Share Posted March 12, 2012 I edited my first post.RunWait(@ComSpec & ' /C ' & ' echo for /r "I:" %%x in (*.txt) do ren "%%x" "*.bak" >~.cmd && ~.cmd && del ~.cmd', "", @SW_HIDE)Does it work now?Yes, it works now. Thank you very much!Hi, Lazyass. Just so I am clear on your intention, do you want to turn every .txt file on your I: drive to a .bak file?Yes, that's the idea. If you have any solution to do so within AutoIt, I would love to hear about it. Link to comment Share on other sites More sharing options...
Chimaera Posted March 12, 2012 Share Posted March 12, 2012 Hi, lazyass, welcome to the forum. It appears from your batch file you're trying to rename a bunch of txt files to .bak. Why not do this purely through AutoIT, and skip the middleman? Notice I used the Desktop directory, as I have no I: drive mapped. $dir = @DesktopDir & "Test" FileMove($dir & "*.txt", $dir & "*.bak") Thats what he gave you earlier !! If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
lazyass Posted March 12, 2012 Author Share Posted March 12, 2012 @Chimaera: And as I wrote...:@JLogan3o13: I would like to do it purely within AutoIT, so I appreciate your advise. It works at the root of I: but I would like to do it recursively. Any ideas how to do that? Link to comment Share on other sites More sharing options...
Chimaera Posted March 12, 2012 Share Posted March 12, 2012 Id prob suggest using and then using the array of files and doing what JLogan3013 suggested If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() 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