Jump to content

FileChangeDir


Go to solution Solved by garyf,

Recommended Posts

Posted

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.

Posted

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 .

Posted

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

Posted

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.

  • Solution
Posted

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

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...