Sign in to follow this  
Followers 0
orbs

"working directory" per drive?

3 posts in this topic

#1 ·  Posted (edited)

DOS remembers the working directory for each drive separately.

how do i use AutoIt functions to make use of that feature?

for example:

#include <File.au3>
#include <Array.au3>

FileChangeDir('C:\TEMP')

; the next command lists the contents of C:\TEMP as expected
RunWait(@ComSpec&' /k dir c: /b')

; the next command lists the contents of C:\ (root), even without the backslash,
; so it's not quite like the help file states: "...Similar to using Dir with the /B Switch"
$a=_FileListToArray('C:')
_ArrayDisplay($a)

EDIT: but this works as expected:

FileCopy('C:*','E:\TEMP\',8)

but if i do this

FileChangeDir('D:')
FileCopy('C:*','E:\TEMP\',8)

then FileCopy() relates to C: root again, even without the backslash. and it keeps it at root.

however with the batch equivalent:

cd c:temp
dir c: /b
cd d:
dir c: /b
 
...the final command still relates to c:temp
Edited by orbs

Share this post


Link to post
Share on other sites



per-process makes sense, as all environment elements can be set differently for every process.

- you can set the same environment variable %MYVAR% to some value for one process, and another value for another process; actually the system will hold two environment variables named %MYVAR%, segregated, one for each process.

- you can "inherit" the environment of a calling process to the called process, but that would be replicating the environment, so if the called process changes something in the environment, the calling process won't see it.

but anyway, per-drive working directory is something i'd like the AutoIt experts to elaborate on, because DOS supports it, so no reason AutoIt wouldn't... but how?

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