Jump to content

"working directory" per drive?


Recommended Posts

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

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
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?

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
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
 Share

  • Recently Browsing   0 members

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