mohan93 Posted November 20, 2013 Share Posted November 20, 2013 Hi Everyone, I have 2 queries, please assist, 1. Rename a file: I have a file in C:TempGLW123.tmp I need to rename the file to Setup.wse and the file should be placed in the same directory C:temp 2. Embedding a .VBS file within the autoScript complied EXE. i can achieve the above renaming functionality using below VBS. SearchFileName = "GLW123.tmp" RenameFileTo = "SETUP.WSE" For each file In folder1.Files 'WScript.Echo (file.Name) If instr(file.name, searchFileName) = 1 Then file.name = renameFileTo Exit For End If Next is there any option to embed this VBS inside the EXE and use the VBS in my autoit script. Please Help. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted November 20, 2013 Moderators Share Posted November 20, 2013 (edited) Hi, mohan93. Why bother using the vbs at all? Check the help file for more info on _FileListToArray. #include <File.au3> #include <Array.au3> Local $aArray = _FileListToArray("C:\Temp", "*", 1) For $i = 1 To $aArray[0] If $aArray[$i] = "GLW123.tmp" Then FileMove("C:\Temp\GLW123.tmp", "C:\Temp\SETUP.WSE", 1) Next Edited November 20, 2013 by JLogan3o13 mohan93 1 "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...
Solution trancexx Posted November 20, 2013 Solution Share Posted November 20, 2013 Hi, mohan93. Why bother using the vbs at all? Check the help file for more info on _FileListToArray. #include <File.au3> #include <Array.au3> Local $aArray = _FileListToArray("C:\Temp", "*", 1) For $i = 1 To $aArray[0] If $aArray[$i] = "GLW123.tmp" Then FileMove("C:\Temp\GLW123.tmp", "C:\Temp\SETUP.WSE", 1) Next Uhm, why are you using _FileListToArray() at all? That doesn't make much sense to me. Just FileMove() it. mohan93 1 ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
mohan93 Posted November 20, 2013 Author Share Posted November 20, 2013 Awesome, Thanks JLogan3o13 and Queen F. Elizabeth MCXI Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted November 20, 2013 Moderators Share Posted November 20, 2013 Trancexx, I only did so because the OP showed that he was doing a search in the vbs in his OP. It appeared he was searching the directory to see if the file exists, and then moving. Otherwise you are of course correct, I would have simply done a FileMove. "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...
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