You are not logged in.

#1 14 May 2014 22:00

carlos
Member
From: Chile
Registered: 04 Nov 2008
Posts: 251
Website

[Undocumented] Input redirection check DPATH

These is other feature undocumented of cmd.

In the redirection input: <
if you specify a file, and it not exist in the current directory, cmd would search it on the DPATH environment variable.

Example:

C:\batch>echo hello>c:\test\in.txt

C:\batch>type c:\test\in.txt
hello

C:\batch>dir /a /b

C:\batch>set /p var=<in.txt
The system cannot find the file specified.

C:\batch>set var
Environment variable var not defined

C:\batch>dpath c:\test;

C:\batch>set /p var=<in.txt

C:\batch>set var
var=hello

C:\batch>

Last edited by carlos (14 May 2014 23:23)

Offline

#2 15 May 2014 15:15

DigitalSnow
Member
From: United States
Registered: 27 Dec 2012
Posts: 24

Re: [Undocumented] Input redirection check DPATH

This is quite interesting.  I was unable to find much about the dpath command especially pertaining to Windows.  However, I found some information regarding dpath for OS/2 which seems to be correct for Windows as well.

DPATH
Gives application programs the search path to data files that are outside the current directory. The DPATH environment variable can only be set using the SET command in OS/2 sessions.
     DPATH ----------|---------|---- path -------|-------------|
                     |- drive -|                 |
                |                                |
                |-------------  ;  --------------|
Related Commands: ;)APPEND ;)PATH and ;)SET Typing DPATH without a parameter displays the current value of the DPATH environment variable. Typing DPATH ; clears the DPATH environment variable. DPATH indicates what directories applications should search for their data files (if an application program uses the DPATH directory list). DPATH is a system environment variable, which means that application programs can query the environment for its value, and, depending on what they find, change their behavior. Like the PATH command, the number of directories you can specify with DPATH is limited only by the length of the command line. The length of a DPATH command can be up to six characters less that the maximum number of characters allowed on the command line. Once you set a search path for data files with DPATH, the path remains in effect for the current command processor until you replace it with another DPATH command. DPATH differs from the APPEND command in how it operates. DPATH tells applications what directories it should search in order to find data files, and it is up to the applications to recognize DPATH. With the APPEND command, however, application programs are able to find files without recognizing that the APPEND command is in effect.

Source: jrttest.com/Help/Os2Cmd.Html#DPATH

Offline

#3 27 Jan 2016 11:50

npocmaka
Member
From: Bulgaria
Registered: 03 Dec 2009
Posts: 446

Re: [Undocumented] Input redirection check DPATH

a link to the the other topic with undocumented DPATHfeatures (topic is closed that's because I reply here)


I can confirm this only on win10 at the moment , but CALL and START looks like also rely on the DPATH value.

dpath %path% 
type win.ini
start "" win.ini
call win.ini
win.ini

all three will start the win.ini with the associated editor.


And I'm not sure if this is a new CALL feature - it can open a non .bat/.exe/.cmd file  with the associated program?

Last edited by npocmaka (27 Jan 2016 12:14)

Offline

#4 27 Jan 2016 17:34

Aacini
Member
Registered: 05 Dec 2012
Posts: 149

Re: [Undocumented] Input redirection check DPATH

Is not all this stuff the documented features of DPATH command?

Allows programs to open data files in specified directories as if they were in
the current directory.

APPEND [[drive:]path[;...]] [/X[:ON | :OFF]] [/PATH:ON | /PATH:OFF] [/E]
APPEND ;

  [drive:]path Specifies a drive and directory to append.
  /X:ON        Applies appended directories to file searches and
               application execution.
  /X:OFF       Applies appended directories only to requests to open files.
               /X:OFF is the default setting.
  /PATH:ON     Applies appended directories to file requests that already
               specify a path.  /PATH:ON is the default setting.
  /PATH:OFF    Turns off the effect of /PATH:ON.
  /E           Stores a copy of the appended directory list in an environment
               variable named APPEND.  /E may be used only the first time
               you use APPEND after starting your system.

Type APPEND ; to clear the appended directory list.
Type APPEND without parameters to display the appended directory list.

Note these two funny details: in my Spanish Windows 8.1 when I type "DPATH /?" the description of APPEND command in Spanish appear, but when  I type "APPEND /?" the previous English description appears!

Antonio

Offline

#5 27 Jan 2016 18:32

npocmaka
Member
From: Bulgaria
Registered: 03 Dec 2009
Posts: 446

Re: [Undocumented] Input redirection check DPATH

Aacini wrote:

Is not all this stuff the documented features of DPATH command?

Allows programs to open data files in specified directories as if they were in
the current directory.

APPEND [[drive:]path[;...]] [/X[:ON | :OFF]] [/PATH:ON | /PATH:OFF] [/E]
APPEND ;

  [drive:]path Specifies a drive and directory to append.
  /X:ON        Applies appended directories to file searches and
               application execution.
  /X:OFF       Applies appended directories only to requests to open files.
               /X:OFF is the default setting.
  /PATH:ON     Applies appended directories to file requests that already
               specify a path.  /PATH:ON is the default setting.
  /PATH:OFF    Turns off the effect of /PATH:ON.
  /E           Stores a copy of the appended directory list in an environment
               variable named APPEND.  /E may be used only the first time
               you use APPEND after starting your system.

Type APPEND ; to clear the appended directory list.
Type APPEND without parameters to display the appended directory list.

Note these two funny details: in my Spanish Windows 8.1 when I type "DPATH /?" the description of APPEND command in Spanish appear, but when  I type "APPEND /?" the previous English description appears!

Antonio

You are using 32 bit windows (you have the APPEND.EXE)
APPEND.EXE is a 16 bit program (there are at least 3 types of files at the moment that have the .exe extension ) and is selfcontained.
While cmd.exe contains its localization info in C:\Windows\System32\en-US\cmd.exe.mui file (this approach was introduced with Vista) - the language and the country code vary.

In cmd.exe DPATH help message points to the localization file and the in the APPEND carries it with itself (16bit executables does not rely on mui files)


But as you can see the documentaion of DPATH is wrong - syntax is the same as PATH but its help message points to APPEND which is missing on x64 systems.


So!

Is START command works with DPATH on windows 8.1 can you confirm it?

EDIT

the reason CALL and direct call of win.ini to start is
due to command extensions (probably the reason MS to abandon append command)

It workds with START because the file is in the same directory as cmd.exe

Last edited by npocmaka (28 Jan 2016 11:29)

Offline

#6 27 Jan 2016 19:37

npocmaka
Member
From: Bulgaria
Registered: 03 Dec 2009
Posts: 446

Re: [Undocumented] Input redirection check DPATH

/offtopic

DigitalSnow wrote:

This is quite interesting.  I was unable to find much about the dpath command especially pertaining to Windows.  However, I found some information regarding dpath for OS/2 which seems to be correct for Windows as well.


Source: jrttest.com/Help/Os2Cmd.Html#DPATH

I've just saw the KEYS command there and the list parameter.does not do nothing bur KEYS LIST does not throw an error.

Offline

#7 27 Jan 2016 21:14

npocmaka
Member
From: Bulgaria
Registered: 03 Dec 2009
Posts: 446

Re: [Undocumented] Input redirection check DPATH

.

Last edited by npocmaka (28 Jan 2016 11:28)

Offline

Board footer

Powered by