Cmd line does not search in user path

Please report only one bug per message!

Moderators: white, sheep, Hacker, Stefan2

Post Reply
NotDifficult
Junior Member
Junior Member
Posts: 10
Joined: 2010-10-25, 05:17 UTC

Cmd line does not search in user path

Post by *NotDifficult » 2013-03-28, 12:11 UTC

TC 7.57a
Windows 7 32bit

Steps to reproduce:
- Add folder a containing program b to user path (not system path!)
- Enter "b" in TC's cmd line
-> "File not found"
- Enter "cmd" then "b"
-> b executes

Expected behaviour:
TC should not only search on the system path but also on the user path.

User avatar
MVV
Power Member
Power Member
Posts: 8121
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV » 2013-03-28, 12:16 UTC

Please describe exact steps you're doing to add folder to user path.

NotDifficult
Junior Member
Junior Member
Posts: 10
Joined: 2010-10-25, 05:17 UTC

Post by *NotDifficult » 2013-03-28, 12:23 UTC

How to set the path in Windows 7:
http://geekswithblogs.net/renso/archive/2009/10/21/how-to-set-the-windows-path-in-windows-7.aspx


The path variable in the upper part I called "user path", the path variable in the lower part is the "system path"


Supplement: Of course, I restarted TC afterwards!

umbra
Power Member
Power Member
Posts: 783
Joined: 2012-01-14, 20:41 UTC

Post by *umbra » 2013-03-28, 12:45 UTC

Not confirmed on (at least on Win8). The user-specific path is properly concatenated to the system-wide path variable. You should try to type a full name of the executable (extension included) - sometimes it's required to resolve its path correctly. Also, does your user-specific path contain other environment variables?
Windows 7 Pro x64, Windows 8.1 Pro x64, Windows 10 Pro x64

User avatar
MVV
Power Member
Power Member
Posts: 8121
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV » 2013-03-28, 12:57 UTC

When I tried it, I added envvar PATH pointing to D:\TEMP in user section of system properties window. After applying changes I've noticed that TC got my path even w/o restarting (it has become added to PATH variable in TC; I've checked it with Process Explorer tool). So I was able to run batch file from that directory by typing only its name. Tested on Win7.

NotDifficult
Junior Member
Junior Member
Posts: 10
Joined: 2010-10-25, 05:17 UTC

Post by *NotDifficult » 2013-03-28, 13:08 UTC

@umbra
Yes! That was it:

My user path contained "%MAVEN_HOME%\bin".
Every path before is recognized correctly, all other path's do not work.

So, the workaround is to remove that entry, but it might be worth fixing it for future releases...

umbra
Power Member
Power Member
Posts: 783
Joined: 2012-01-14, 20:41 UTC

Post by *umbra » 2013-03-28, 13:24 UTC

This is not a TC issue. IIRC, TC does not see two path variables, only one provided by Windows.
Environment variables in user-specific path shouldn't be a problem. First, does %MAVEN_HOME% really exist? And if yes, is it just that one variable that's causing the problem?
Windows 7 Pro x64, Windows 8.1 Pro x64, Windows 10 Pro x64

NotDifficult
Junior Member
Junior Member
Posts: 10
Joined: 2010-10-25, 05:17 UTC

Post by *NotDifficult » 2013-03-28, 14:01 UTC

Again a very good guess!

%MAVEN_HOME% does exist. However, it ends with a backslash.

"%MAVEN_HOME%\bin" thus results in two backslashes.

Removing the backslash from the path ("%MAVEN_HOME%bin") solves this issue.


BTW, having two backslashes:
- mvn can be launch by cmd.
- mvn cannot be launch from TC's cmd line.
- mvn cannot be launch using Win+R

Having just one backslash:
- mvn can be launch by cmd.
- mvn can be launch from TC's cmd line.
- mvn can be launch using Win+R

So, it's indeed not really a TC issue. However, cmd deals with it better. Couldn't TC be enhanced the same way?

User avatar
MVV
Power Member
Power Member
Posts: 8121
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV » 2013-03-28, 16:20 UTC

Strange, multiple slashes shouldn't be a problem. Anyway, it isn't hard to fix envvars to make it working everywhere.

umbra
Power Member
Power Member
Posts: 783
Joined: 2012-01-14, 20:41 UTC

Post by *umbra » 2013-03-28, 22:34 UTC

MVV wrote:Strange, multiple slashes shouldn't be a problem.
Well, multiple backslashes are unofficially tolerated, but not valid. Sometimes they work, sometimes not.
Windows 7 Pro x64, Windows 8.1 Pro x64, Windows 10 Pro x64

Post Reply