NP++ in Windows Shell - Path problem

2011-12-13
2012-11-15
  • Markus Fried

    Markus Fried - 2011-12-13

    Hi,

    I'm primarily using NP++ from within the Win7 Shell. When I try something like notepad++.exe \test\test.txt (existing file) I'll get an empty editor - I have to use notepad++.exe C:\test\test.txt (note the drive letter!) to get the file. This ist most annoying, since I'm giving a valid path to NP++.

    Is this a bug or a wrong setting somewhere?

    Best regards
    Markus.

    PS: I've turned off the "remember last file" option.

     
  • Markus Fried

    Markus Fried - 2011-12-13

    Sorry, forgot: I'm using the latest version ;-)

     
  • Markus Fried

    Markus Fried - 2011-12-13

    the example given above is not correct, the problem occures only when I'm not on Drive C:

    So the example is: I'm on D: and try to notepad++.exe \test\test.txt (existing file) and get "C:\test\test.txt doesn't exist. Create it?"

    notepad++.exe d:\test\test.txt works - so NP++ obviously precedes the given path with C: which is not correct, is it?

     
  • Markus Fried

    Markus Fried - 2012-01-10

    I'm still stuck with this behaviour - checked other editors (even notepad) that open the correct file given a relative path.

    Any clues how I can overcome this?

    Best regards

    Mark.

     
  • Loreia2

    Loreia2 - 2012-01-10

    Hi Mark,

    in windows shell (command prompt) "." represents "current directory", and ".." parent directory.

    So, you need to build your path either:

    1. from current directory:
    1a) "./test/test.txt " (for subdirectories)
    1b) "../test.txt" (for parent directory)

    2. use absolute path that includes drive letter

    BR
    Loreia

     
  • Markus Fried

    Markus Fried - 2012-01-10

    hmm, since the windows shell also accepts the '\' as the root of the current drive your list is not complete:

    1 c) "\test\test.txt" (relative path starting at the root dir of the current drive)

    try it with notepad or pspad or ultraedit, it works ;-)

    I never had to use

     
  • Loreia2

    Loreia2 - 2012-01-10

    Indeed,

    http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247%28v=vs.85%29.aspx

    A file name is relative to the current directory if it does not begin with one of the following:

        A UNC name of any format, which always start with two backslash characters ("\\"). For more information, see the next section.
        A disk designator with a backslash, for example "C:\" or "d:\".
        A single backslash, for example, "\directory" or "\file.txt". This is also referred to as an absolute path.

    I was not aware of this. Thanks for info.

    Logically, it should be a "job" of the shell to expand path before giving it as an argument to NPP. I tried to find environment variable that would represent drive letter, but I can't find it (e.g here is the list for XP: https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds_shelloverview.mspx?mfr=true)

    One thing you can do is to register file extension with NPP, and then just try to specify file path and appropriate application will start automatically.

    BR
    Loreia

     
  • Markus Fried

    Markus Fried - 2012-01-11

    I had a look into the source, obviously NP++ uses GetFullPath() on the given command line argument. Why this is necessary I'm not sure. But this API call uses the drive letter for the application install directory to complete the given path, not the current drive from which the app got invoked. So I propably can't change this stupid behaviour :(

     
  • Loreia2

    Loreia2 - 2012-01-11

    Hi,

    1. you can always send a path to Don, and have it fixed in next version.
    2. you can register NPP as default application for .txt extension (or which ever extension it was you needed), and start your files simply by issuing command in cmd:
    \test\test.txt
    instead of the old way:
    notepad++.exe \test\test.txt

    BR
    Loreia

     
  • Anonymous - 2012-11-05

    Hi,

    I had this issue. I found a solution. I created new network drive using the windows explorer menu -> Tools -> Map Network Drive. I am able to view my  UNC path files.

    And the CMD command pushd (enable UNC path) and popd (disable UNC path) also works well. But for me the mapping the network drive option is works fine.

     
  • Loreia2

    Loreia2 - 2012-11-15

    Thanks for reminding me of this.
    Patch was set to Don earlier today.

    BR
    Loreia

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks