KenRainsforth Posted July 26, 2007 Share Posted July 26, 2007 Hi everybody Help I'm new to AutoIt and I have a little problem. Im editing and running the program from the SciTE editor. I want to rename a directory, my script is ... $olddir = Chr(34) & IniRead($inifile, "Migrate", "Root_Dir", "NotFound") & Chr(34) $newdir = "D:\Demos\NXT Test\Test Library\Temp" ;Folder rename Migrated to Temp (This was the last built folder) ;Because AutoIt lacks a "FileRename" function, use FileMove to rename a file! MsgBox(4096,"",$olddir & "Directory will be renamed " & $newdir) DirMove($olddir, $newdir, 1) If @error Then MsgBox(4096,"Could not rename directory","Press OK to quit program") Exit Else MsgBox(4096,"","Renamed " & $olddir) EndIf If I use literal filepaths like this ..... DirMove("D:\Demos\NXT Test\Test Library\Migrated", "D:\Demos\NXT Test\Test Library\Temp") it works Also I dont get at an error from the first example. I'm using the latest release of AutoIt. What am I doing wrong? Any help would be appreciated. Ken Link to comment Share on other sites More sharing options...
Developers Jos Posted July 26, 2007 Developers Share Posted July 26, 2007 don't need to put Double quotes in the string... $olddir = IniRead($inifile, "Migrate", "Root_Dir", "NotFound") SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
MHz Posted July 26, 2007 Share Posted July 26, 2007 What am I doing wrong?To add to what JdeB suggests, you only need to quote the paths in the functions to run files reliably that contain spaces. Example: Run('"quote paths with spaces"') RunWait('"quote paths with spaces"') ShellExecute('"quote paths with spaces"') Run(@ComSpec & ' /c "quote paths with spaces"') Other functions do not like quotes so they may fail through trying. 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