Sign in to follow this  
Followers 0
garyf

FileChangeDir

10 posts in this topic

Hi

Newbie here. I'm using FileChangeDir($p) to change the current dir to the path in var $p. It does not work. Works if I code FileChangeDir("d:AutoITdata").

Any ideas would be greatly appreciated.

Share this post


Link to post
Share on other sites



Sorry, when I wrote it doesn't work, I meant that the original content of the working directory was unchanged. It changed only when I used a explicit string in quotes .

Share this post


Link to post
Share on other sites

Now I'm getting more weird stuff

#include "MsgBoxConstants.au3"

; set up working dir

FileChangeDir("D:A-Screenshots")

msgbox(0,"testing 1","working dir: ",@WorkingDir)            ;<=== this displays a blank for the working dir

$var = "d:Games"
FileChangeDir($var)
msgbox(0,"testing 2","working dir: ",@WorkingDir)         ;<=== this displas a blank for the working dir
example()
exit

Func Example()
    ; Display the current working directory.
    MsgBox($MB_SYSTEMMODAL, "", "The current working directory: " & @CRLF & @WorkingDir)     <===== this displays d:Games

    ; Set the working directory @WorkingDir to the @WindowsDir directory. This is normally C:Windows.
    FileChangeDir(@WindowsDir)

    ; Display the working directory after setting it to the windows directory.
    MsgBox($MB_SYSTEMMODAL, "", "The current working directory: " & @CRLF & @WorkingDir)    <==== displays C:Windows
EndFunc   ;==>Example

Share this post


Link to post
Share on other sites

I swapped the order of the two filechangedir and get similar results. They both display a blanks for the working dir. but in the function the first msgbox dispays D:A-Screenshots.

Share this post


Link to post
Share on other sites

I found it! jeez! The error is in the msgbox. It is incorrectly coded.

msgbox(0,"testing 1","working dir: ",@WorkingDir)    wrong!

msgbox(0,"testing 1","working dir: " & @WorkingDir)   correct

Share this post


Link to post
Share on other sites

Thanks for helping John1

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0