Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #102991 > unrolled thread
| Started by | Ulli Horlacher <framstag@rus.uni-stuttgart.de> |
|---|---|
| First post | 2016-02-16 08:30 +0000 |
| Last post | 2016-02-16 07:17 -0600 |
| Articles | 20 on this page of 28 — 7 participants |
Back to article view | Back to comp.lang.python
extending PATH on Windows? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2016-02-16 08:30 +0000
Re: extending PATH on Windows? Thorsten Kampe <thorsten@thorstenkampe.de> - 2016-02-16 13:19 +0100
Re: extending PATH on Windows? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2016-02-16 12:38 +0000
Re: extending PATH on Windows? Thorsten Kampe <thorsten@thorstenkampe.de> - 2016-02-16 14:38 +0100
Re: extending PATH on Windows? Thorsten Kampe <thorsten@thorstenkampe.de> - 2016-02-16 14:43 +0100
Re: extending PATH on Windows? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2016-02-17 17:49 +0000
Re: extending PATH on Windows? eryk sun <eryksun@gmail.com> - 2016-02-17 13:02 -0600
Re: extending PATH on Windows? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2016-02-17 20:29 +0000
Re: extending PATH on Windows? eryk sun <eryksun@gmail.com> - 2016-02-17 15:17 -0600
Re: extending PATH on Windows? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2016-02-17 22:37 +0000
Re: extending PATH on Windows? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2016-02-18 16:55 +0000
Re: extending PATH on Windows? eryk sun <eryksun@gmail.com> - 2016-02-19 12:07 -0600
Re: extending PATH on Windows? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2016-02-17 19:53 -0500
Re: extending PATH on Windows? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2016-02-18 16:24 +0000
Re: extending PATH on Windows? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2016-02-18 21:57 -0500
Re: extending PATH on Windows? pyotr filipivich <phamp@mindspring.com> - 2016-02-18 19:39 -0800
Re: extending PATH on Windows? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2016-02-19 10:42 +0000
Re: extending PATH on Windows? Chris Angelico <rosuav@gmail.com> - 2016-02-19 21:48 +1100
Re: extending PATH on Windows? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2016-02-19 07:45 -0500
Re: extending PATH on Windows? Gisle Vanem <gvanem@yahoo.no> - 2016-02-19 15:18 +0100
Re: extending PATH on Windows? pyotr filipivich <phamp@mindspring.com> - 2016-02-19 09:04 -0800
Re: extending PATH on Windows? eryk sun <eryksun@gmail.com> - 2016-02-19 12:04 -0600
Re: extending PATH on Windows? eryk sun <eryksun@gmail.com> - 2016-02-19 12:42 -0600
Re: extending PATH on Windows? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2016-02-19 19:57 -0500
Re: extending PATH on Windows? eryk sun <eryksun@gmail.com> - 2016-02-20 07:31 -0600
Re: extending PATH on Windows? eryk sun <eryksun@gmail.com> - 2016-02-18 06:54 -0600
Re: extending PATH on Windows? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2016-02-18 16:50 +0000
Re: extending PATH on Windows? eryk sun <eryksun@gmail.com> - 2016-02-16 07:17 -0600
Page 1 of 2 [1] 2 Next page →
| From | Ulli Horlacher <framstag@rus.uni-stuttgart.de> |
|---|---|
| Date | 2016-02-16 08:30 +0000 |
| Subject | extending PATH on Windows? |
| Message-ID | <n9umo3$9lg$1@news2.informatik.uni-stuttgart.de> |
I need to extend the PATH environment variable on Windows.
So far, I use:
system('setx PATH "%PATH%;'+bindir+'"')
The problem: In a new process (cmd.exe) PATH contains a lot of double
elements. As far as I have understood, Windows builds the PATH
environment variable from a system component and a user component. With
the setx command from above I have copied the system PATH into the user
PATH component.
Is there a better way to extend the PATH environment variable for the user?
It must be persistent, not only for the current process.
--
Ullrich Horlacher Server und Virtualisierung
Rechenzentrum IZUS/TIK E-Mail: horlacher@tik.uni-stuttgart.de
Universitaet Stuttgart Tel: ++49-711-68565868
Allmandring 30a Fax: ++49-711-682357
70550 Stuttgart (Germany) WWW: http://www.tik.uni-stuttgart.de/
[toc] | [next] | [standalone]
| From | Thorsten Kampe <thorsten@thorstenkampe.de> |
|---|---|
| Date | 2016-02-16 13:19 +0100 |
| Message-ID | <mailman.160.1455625190.22075.python-list@python.org> |
| In reply to | #102991 |
* Ulli Horlacher (Tue, 16 Feb 2016 08:30:59 +0000 (UTC))
> I need to extend the PATH environment variable on Windows.
>
> So far, I use:
>
> system('setx PATH "%PATH%;'+bindir+'"')
>
> The problem: In a new process (cmd.exe) PATH contains a lot of double
> elements. As far as I have understood, Windows builds the PATH
> environment variable from a system component and a user component. With
> the setx command from above I have copied the system PATH into the user
> PATH component.
>
> Is there a better way to extend the PATH environment variable for the user?
> It must be persistent, not only for the current process.
`os.system` should be `subprocess.call` on modern systems (actually
`subprocess.run` if you have Python 3.5). Since `setx` doesn't seem
to have unique and add options, you basically have two options:
1. Add the path component yourself into HKEY_CURRENT_USER and make
sure it's not there already (pure Python).
2. a) use a shell that offers that capability with `set`:
https://jpsoft.com/help/set.htm (TCC/LE is free)
b) use a dedicated environment variable editor:
http://www.rapidee.com/en/command-line
Thorsten
[toc] | [prev] | [next] | [standalone]
| From | Ulli Horlacher <framstag@rus.uni-stuttgart.de> |
|---|---|
| Date | 2016-02-16 12:38 +0000 |
| Message-ID | <n9v58k$dcl$1@news2.informatik.uni-stuttgart.de> |
| In reply to | #102997 |
Thorsten Kampe <thorsten@thorstenkampe.de> wrote: > * Ulli Horlacher (Tue, 16 Feb 2016 08:30:59 +0000 (UTC)) > > I need to extend the PATH environment variable on Windows. > > 1. Add the path component yourself into HKEY_CURRENT_USER and make > sure it's not there already (pure Python). Preferred! What is HKEY_CURRENT_USER? Another environment variable? -- Ullrich Horlacher Server und Virtualisierung Rechenzentrum IZUS/TIK E-Mail: horlacher@tik.uni-stuttgart.de Universitaet Stuttgart Tel: ++49-711-68565868 Allmandring 30a Fax: ++49-711-682357 70550 Stuttgart (Germany) WWW: http://www.tik.uni-stuttgart.de/
[toc] | [prev] | [next] | [standalone]
| From | Thorsten Kampe <thorsten@thorstenkampe.de> |
|---|---|
| Date | 2016-02-16 14:38 +0100 |
| Message-ID | <mailman.167.1455629937.22075.python-list@python.org> |
| In reply to | #102998 |
* Ulli Horlacher (Tue, 16 Feb 2016 12:38:44 +0000 (UTC)) > > Thorsten Kampe <thorsten@thorstenkampe.de> wrote: > > * Ulli Horlacher (Tue, 16 Feb 2016 08:30:59 +0000 (UTC)) > > > I need to extend the PATH environment variable on Windows. > > > > 1. Add the path component yourself into HKEY_CURRENT_USER and make > > sure it's not there already (pure Python). > > Preferred! > What is HKEY_CURRENT_USER? Another environment variable? It's a hive in the Windows registry and the equivalent of `~/.*` in Linux terms (HKEY_LOCAL_MACHINE[/Software] being the equivalent of `/etc`). The fact that you're asking indicates that you should read about that in advance. The task itself is definitely not that hard. Maybe someone has already asked at StackOverflow. But the devil's in the detail. Some things to consider - Python is not by default installed on Windows, so you have to use a way to run your script without (PyInstaller for instance). - by default there is no entry in HKCU, so you have to create it first (under HKEY_CURRENT_USER\Environment). - you need to create the correct type (REG_SZ, null-terminated string) - Windows paths are semicolon separated (not colon). - Windows only module for the Registry: https://docs.python.org/3/library/winreg.html Thorsten
[toc] | [prev] | [next] | [standalone]
| From | Thorsten Kampe <thorsten@thorstenkampe.de> |
|---|---|
| Date | 2016-02-16 14:43 +0100 |
| Message-ID | <mailman.168.1455630261.22075.python-list@python.org> |
| In reply to | #102998 |
* Ulli Horlacher (Tue, 16 Feb 2016 12:38:44 +0000 (UTC)) By the way: there is a script called `win_add2path.py` in your Python distribution which "is a simple script to add Python to the Windows search path. It modifies the current user (HKCU) tree of the registry.". That should do most of what you want. Thorsten
[toc] | [prev] | [next] | [standalone]
| From | Ulli Horlacher <framstag@rus.uni-stuttgart.de> |
|---|---|
| Date | 2016-02-17 17:49 +0000 |
| Message-ID | <na2bqn$7d7$1@news2.informatik.uni-stuttgart.de> |
| In reply to | #103007 |
Thorsten Kampe <thorsten@thorstenkampe.de> wrote:
> By the way: there is a script called `win_add2path.py` in your Python
> distribution
I have
"Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20:32:19) [MSC
v.1500 32 bit (Intel)] on win32"
and there is no "win_add2path.py"
But I found another solution:
I need the extended PATH only for cmd.exe: users shall run my program
(a compiled executable) without having to enter the full path.
At startup cmd.exe runs a script which is defined by the registry variable
AutoRun in "HKCU\Software\Microsoft\Command Processor"
I set this variable with:
rc = "HKCU\Software\Microsoft\Command Processor"
ar = "%USERPROFILE%\Desktop\autorun.cmd"
system('reg add "%s" /v AutoRun /d "%s"' % (rc,ar))
and write into autorun.cmd:
set PATH=%PATH%;%USERPROFILE%\Desktop
This command extends PATH only for this cmd.exe instance.
This is all I need!
--
Ullrich Horlacher Server und Virtualisierung
Rechenzentrum IZUS/TIK E-Mail: horlacher@tik.uni-stuttgart.de
Universitaet Stuttgart Tel: ++49-711-68565868
Allmandring 30a Fax: ++49-711-682357
70550 Stuttgart (Germany) WWW: http://www.tik.uni-stuttgart.de/
[toc] | [prev] | [next] | [standalone]
| From | eryk sun <eryksun@gmail.com> |
|---|---|
| Date | 2016-02-17 13:02 -0600 |
| Message-ID | <mailman.217.1455735785.22075.python-list@python.org> |
| In reply to | #103058 |
On Wed, Feb 17, 2016 at 11:49 AM, Ulli Horlacher
<framstag@rus.uni-stuttgart.de> wrote:
> At startup cmd.exe runs a script which is defined by the registry variable
> AutoRun in "HKCU\Software\Microsoft\Command Processor"
>
> I set this variable with:
>
> rc = "HKCU\Software\Microsoft\Command Processor"
> ar = "%USERPROFILE%\Desktop\autorun.cmd"
> system('reg add "%s" /v AutoRun /d "%s"' % (rc,ar))
>
> and write into autorun.cmd:
>
> set PATH=%PATH%;%USERPROFILE%\Desktop
The AutoRun command (it's a command line, not a script path) gets run
for every instance of cmd.exe, unless cmd is started with the /D
option. This includes the CRT's system() function. Your batch file
needs to set a sentinel variable such as YOUR_APP_AUTORUN that, if
set, makes the batch file exit without extending PATH if it was
already done.
Also, you can't just overwrite a user's AutoRun command like that. If
a command currently exists, you have to concatenate your command with
the existing command using parentheses and the "&" operator, e.g.
(previous_command) & (your_command). Use winreg for this.
[toc] | [prev] | [next] | [standalone]
| From | Ulli Horlacher <framstag@rus.uni-stuttgart.de> |
|---|---|
| Date | 2016-02-17 20:29 +0000 |
| Message-ID | <na2l7h$a97$1@news2.informatik.uni-stuttgart.de> |
| In reply to | #103062 |
eryk sun <eryksun@gmail.com> wrote:
> > At startup cmd.exe runs a script which is defined by the registry variable
> > AutoRun in "HKCU\Software\Microsoft\Command Processor"
> >
> > I set this variable with:
> >
> > rc = "HKCU\Software\Microsoft\Command Processor"
> > ar = "%USERPROFILE%\Desktop\autorun.cmd"
> > system('reg add "%s" /v AutoRun /d "%s"' % (rc,ar))
> >
> > and write into autorun.cmd:
> >
> > set PATH=%PATH%;%USERPROFILE%\Desktop
>
> The AutoRun command (it's a command line, not a script path)
A script path is a legal command line, too.
> gets run for every instance of cmd.exe
Yes, this is the intended trick!
> Your batch file needs to set a sentinel variable such as YOUR_APP_AUTORUN
> that, if set, makes the batch file exit without extending PATH if it was
> already done.
Having "%USERPROFILE%\Desktop" twice in PATH is not a problem.
> Also, you can't just overwrite a user's AutoRun command like that. If
> a command currently exists, you have to concatenate your command with
> the existing command using parentheses and the "&" operator, e.g.
> (previous_command) & (your_command).
Good hint, thanks!
> Use winreg for this.
system("reg ...") works for me and is easier :-)
--
Ullrich Horlacher Server und Virtualisierung
Rechenzentrum IZUS/TIK E-Mail: horlacher@tik.uni-stuttgart.de
Universitaet Stuttgart Tel: ++49-711-68565868
Allmandring 30a Fax: ++49-711-682357
70550 Stuttgart (Germany) WWW: http://www.tik.uni-stuttgart.de/
[toc] | [prev] | [next] | [standalone]
| From | eryk sun <eryksun@gmail.com> |
|---|---|
| Date | 2016-02-17 15:17 -0600 |
| Message-ID | <mailman.222.1455743909.22075.python-list@python.org> |
| In reply to | #103066 |
On Wed, Feb 17, 2016 at 2:29 PM, Ulli Horlacher
<framstag@rus.uni-stuttgart.de> wrote:
> eryk sun <eryksun@gmail.com> wrote:
>> >
>> > set PATH=%PATH%;%USERPROFILE%\Desktop
>>
>> The AutoRun command (it's a command line, not a script path)
>
> A script path is a legal command line, too.
If the registry value were just a script path, you'd have to modify
your script to chain to the previous script, if any. Since it's a
command line you can simply use the & operator to append another
command.
>> gets run for every instance of cmd.exe
>
> Yes, this is the intended trick!
Do you really intend for your batch file to be run every time cmd.exe
is executed, including every time that every program on the machine
calls the CRT system() function?
Why don't you just install a shortcut to a batch file that starts a
command prompt with the extended PATH?
>> Also, you can't just overwrite a user's AutoRun command like that. If
>> a command currently exists, you have to concatenate your command with
>> the existing command using parentheses and the "&" operator, e.g.
>> (previous_command) & (your_command).
>
> Good hint, thanks!
>
>> Use winreg for this.
>
> system("reg ...") works for me and is easier :-)
system('reg...') won't be able to do that unless you export the key to
a .reg file and parse the existing AutoRun value. It would be simpler
to use subprocess.check_output('reg query ...'), but simpler still and
more reliable to just call QueryValueEx.
[toc] | [prev] | [next] | [standalone]
| From | Ulli Horlacher <framstag@rus.uni-stuttgart.de> |
|---|---|
| Date | 2016-02-17 22:37 +0000 |
| Message-ID | <na2sn9$c49$1@news2.informatik.uni-stuttgart.de> |
| In reply to | #103072 |
eryk sun <eryksun@gmail.com> wrote:
> >> The AutoRun command (it's a command line, not a script path)
> >
> > A script path is a legal command line, too.
>
> If the registry value were just a script path, you'd have to modify
> your script to chain to the previous script, if any. Since it's a
> command line you can simply use the & operator to append another
> command.
This is the better way, no question. I will change it.
> Do you really intend for your batch file to be run every time cmd.exe
> is executed, including every time that every program on the machine
> calls the CRT system() function?
Yes. It just extends PATH, it should not do any harm.
> Why don't you just install a shortcut to a batch file that starts a
> command prompt with the extended PATH?
Hmm... how does a user starts this shortcut, when it is not found in PATH?
> system('reg...') won't be able to do that unless you export the key to
> a .reg file and parse the existing AutoRun value. It would be simpler
> to use subprocess.check_output('reg query ...')
I do it this way, already.
> but simpler still and more reliable to just call QueryValueEx.
I find it more complicated.
--
Ullrich Horlacher Server und Virtualisierung
Rechenzentrum IZUS/TIK E-Mail: horlacher@tik.uni-stuttgart.de
Universitaet Stuttgart Tel: ++49-711-68565868
Allmandring 30a Fax: ++49-711-682357
70550 Stuttgart (Germany) WWW: http://www.tik.uni-stuttgart.de/
[toc] | [prev] | [next] | [standalone]
| From | Ulli Horlacher <framstag@rus.uni-stuttgart.de> |
|---|---|
| Date | 2016-02-18 16:55 +0000 |
| Message-ID | <na4t21$skl$3@news2.informatik.uni-stuttgart.de> |
| In reply to | #103076 |
Ulli Horlacher <framstag@rus.uni-stuttgart.de> wrote:
> > but simpler still and more reliable to just call QueryValueEx.
>
> I find it more complicated.
I have now (after long studying docs and examples)::
def get_winreg(key,subkey):
try:
rkey = winreg.OpenKey(winreg.HKEY_CURRENT_USER,key,0,winreg.KEY_READ)
rvalue,rtype = winreg.QueryValueEx(rkey,subkey)
winreg.CloseKey(rkey)
except WindowsError:
rvalue,rtype = None,None
return rvalue
def set_winreg(key,subkey,value):
winreg.CreateKey(winreg.HKEY_CURRENT_USER,key)
rkey = winreg.OpenKey(winreg.HKEY_CURRENT_USER,key,0,winreg.KEY_WRITE)
winreg.SetValueEx(rkey,subkey,0,winreg.REG_SZ,value)
winreg.CloseKey(rkey)
--
Ullrich Horlacher Server und Virtualisierung
Rechenzentrum IZUS/TIK E-Mail: horlacher@tik.uni-stuttgart.de
Universitaet Stuttgart Tel: ++49-711-68565868
Allmandring 30a Fax: ++49-711-682357
70550 Stuttgart (Germany) WWW: http://www.tik.uni-stuttgart.de/
[toc] | [prev] | [next] | [standalone]
| From | eryk sun <eryksun@gmail.com> |
|---|---|
| Date | 2016-02-19 12:07 -0600 |
| Message-ID | <mailman.56.1455905293.2289.python-list@python.org> |
| In reply to | #103137 |
On Thu, Feb 18, 2016 at 10:55 AM, Ulli Horlacher <framstag@rus.uni-stuttgart.de> wrote: > Ulli Horlacher <framstag@rus.uni-stuttgart.de> wrote: > >> > but simpler still and more reliable to just call QueryValueEx. >> >> I find it more complicated. > > I have now (after long studying docs and examples):: > > def get_winreg(key,subkey): > try: > rkey = winreg.OpenKey(winreg.HKEY_CURRENT_USER,key,0,winreg.KEY_READ) > rvalue,rtype = winreg.QueryValueEx(rkey,subkey) > winreg.CloseKey(rkey) > except WindowsError: > rvalue,rtype = None,None > return rvalue The 2nd parameter should be named "value_name", not "subkey". A registry key is similar to an NTFS file-system node, and values are similar to NTFS $DATA streams [1], but with different types of data [2] other than just REG_BINARY, to make it easier to store structured configuration data. [1]: https://msdn.microsoft.com/en-us/library/aa364404 [2]: https://msdn.microsoft.com/en-us/library/ms724884
[toc] | [prev] | [next] | [standalone]
| From | Dennis Lee Bieber <wlfraed@ix.netcom.com> |
|---|---|
| Date | 2016-02-17 19:53 -0500 |
| Message-ID | <mailman.227.1455756824.22075.python-list@python.org> |
| In reply to | #103058 |
On Wed, 17 Feb 2016 17:49:11 +0000 (UTC), Ulli Horlacher
<framstag@rus.uni-stuttgart.de> declaimed the following:
>Thorsten Kampe <thorsten@thorstenkampe.de> wrote:
>
>> By the way: there is a script called `win_add2path.py` in your Python
>> distribution
>
>I have
>"Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20:32:19) [MSC
>v.1500 32 bit (Intel)] on win32"
>and there is no "win_add2path.py"
>
C:\Python_x64\Python27\Tools\scripts\win_add2path.py
PythonWin 2.7.5 (default, Sep 16 2013, 23:11:01) [MSC v.1500 64 bit
(AMD64)] on win32.
Portions Copyright 1994-2008 Mark Hammond - see 'Help/About PythonWin' for
further copyright information.
But I can't confirm that this is not something added in the ActiveState
release.
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
[toc] | [prev] | [next] | [standalone]
| From | Ulli Horlacher <framstag@rus.uni-stuttgart.de> |
|---|---|
| Date | 2016-02-18 16:24 +0000 |
| Message-ID | <na4r70$skl$1@news2.informatik.uni-stuttgart.de> |
| In reply to | #103077 |
Dennis Lee Bieber <wlfraed@ix.netcom.com> wrote: > >I have > >"Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20:32:19) [MSC > >v.1500 32 bit (Intel)] on win32" > >and there is no "win_add2path.py" > > > C:\Python_x64\Python27\Tools\scripts\win_add2path.py Ok, It is here in C:\Python27\Tools\scripts\win_add2path.py but windows "Search programs and files" was not able to find it. -- Ullrich Horlacher Server und Virtualisierung Rechenzentrum IZUS/TIK E-Mail: horlacher@tik.uni-stuttgart.de Universitaet Stuttgart Tel: ++49-711-68565868 Allmandring 30a Fax: ++49-711-682357 70550 Stuttgart (Germany) WWW: http://www.tik.uni-stuttgart.de/
[toc] | [prev] | [next] | [standalone]
| From | Dennis Lee Bieber <wlfraed@ix.netcom.com> |
|---|---|
| Date | 2016-02-18 21:57 -0500 |
| Message-ID | <mailman.32.1455850652.2289.python-list@python.org> |
| In reply to | #103133 |
On Thu, 18 Feb 2016 16:24:00 +0000 (UTC), Ulli Horlacher
<framstag@rus.uni-stuttgart.de> declaimed the following:
>Dennis Lee Bieber <wlfraed@ix.netcom.com> wrote:
>
>> >I have
>> >"Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20:32:19) [MSC
>> >v.1500 32 bit (Intel)] on win32"
>> >and there is no "win_add2path.py"
>> >
>> C:\Python_x64\Python27\Tools\scripts\win_add2path.py
>
>Ok, It is here in C:\Python27\Tools\scripts\win_add2path.py
>but windows "Search programs and files" was not able to find it.
Windows (especially 7) search function is highly crippled. There is
some command sequence that will open it up to looking at other file types
and locations.
http://answers.microsoft.com/en-us/windows/forum/windows_7-files/windows-7-search-does-not-find-files-that-it/61b88d5e-7df7-4427-8a2e-82b801a4a746?auth=1
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
[toc] | [prev] | [next] | [standalone]
| From | pyotr filipivich <phamp@mindspring.com> |
|---|---|
| Date | 2016-02-18 19:39 -0800 |
| Message-ID | <eh3dcb55vautec6gtrum8bka9lv762o5v4@4ax.com> |
| In reply to | #103166 |
Dennis Lee Bieber <wlfraed@ix.netcom.com> on Thu, 18 Feb 2016 21:57:13 -0500 typed in comp.lang.python the following: >On Thu, 18 Feb 2016 16:24:00 +0000 (UTC), Ulli Horlacher ><framstag@rus.uni-stuttgart.de> declaimed the following: > >>Dennis Lee Bieber <wlfraed@ix.netcom.com> wrote: >> >>> >I have >>> >"Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20:32:19) [MSC >>> >v.1500 32 bit (Intel)] on win32" >>> >and there is no "win_add2path.py" >>> > >>> C:\Python_x64\Python27\Tools\scripts\win_add2path.py >> >>Ok, It is here in C:\Python27\Tools\scripts\win_add2path.py >>but windows "Search programs and files" was not able to find it. > > Windows (especially 7) search function is highly crippled. There is >some command sequence that will open it up to looking at other file types >and locations. > >http://answers.microsoft.com/en-us/windows/forum/windows_7-files/windows-7-search-does-not-find-files-that-it/61b88d5e-7df7-4427-8a2e-82b801a4a746?auth=1 Thanks. I've found it "simpler" to just open a command prompt, and use DOS. -- pyotr filipivich Next month's Panel: Graft - Boon or blessing?
[toc] | [prev] | [next] | [standalone]
| From | Ulli Horlacher <framstag@rus.uni-stuttgart.de> |
|---|---|
| Date | 2016-02-19 10:42 +0000 |
| Message-ID | <na6rjc$dlr$1@news2.informatik.uni-stuttgart.de> |
| In reply to | #103170 |
pyotr filipivich <phamp@mindspring.com> wrote: > > Windows (especially 7) search function is highly crippled. There is > >some command sequence that will open it up to looking at other file types > >and locations. > > > >http://answers.microsoft.com/en-us/windows/forum/windows_7-files/windows-7-search-does-not-find-files-that-it/61b88d5e-7df7-4427-8a2e-82b801a4a746?auth=1 > > > Thanks. I've found it "simpler" to just open a command prompt, and > use DOS. How can one search for files with DOS? -- Ullrich Horlacher Server und Virtualisierung Rechenzentrum IZUS/TIK E-Mail: horlacher@tik.uni-stuttgart.de Universitaet Stuttgart Tel: ++49-711-68565868 Allmandring 30a Fax: ++49-711-682357 70550 Stuttgart (Germany) WWW: http://www.tik.uni-stuttgart.de/
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2016-02-19 21:48 +1100 |
| Message-ID | <mailman.39.1455878933.2289.python-list@python.org> |
| In reply to | #103180 |
On Fri, Feb 19, 2016 at 9:42 PM, Ulli Horlacher <framstag@rus.uni-stuttgart.de> wrote: > pyotr filipivich <phamp@mindspring.com> wrote: > >> > Windows (especially 7) search function is highly crippled. There is >> >some command sequence that will open it up to looking at other file types >> >and locations. >> > >> >http://answers.microsoft.com/en-us/windows/forum/windows_7-files/windows-7-search-does-not-find-files-that-it/61b88d5e-7df7-4427-8a2e-82b801a4a746?auth=1 >> >> >> Thanks. I've found it "simpler" to just open a command prompt, and >> use DOS. > > How can one search for files with DOS? dir /s /b \*add2path.* ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Dennis Lee Bieber <wlfraed@ix.netcom.com> |
|---|---|
| Date | 2016-02-19 07:45 -0500 |
| Message-ID | <mailman.45.1455885944.2289.python-list@python.org> |
| In reply to | #103180 |
On Fri, 19 Feb 2016 21:48:45 +1100, Chris Angelico <rosuav@gmail.com>
declaimed the following:
>On Fri, Feb 19, 2016 at 9:42 PM, Ulli Horlacher
><framstag@rus.uni-stuttgart.de> wrote:
<snip>
>> How can one search for files with DOS?
>
>dir /s /b \*add2path.*
>
>ChrisA
Or move to PowerShell...
Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.
PS C:\Users\Wulfraed\Documents> Get-ChildItem -Path c:\ -Filter *add2path*
-Name -Recurse
GNAT\2014\share\gdb-7.7\python-2.7.3\Tools\Scripts\win_add2path.py
Python_x64\Python27\Tools\scripts\win_add2path.py
Python_x64\Python33\Tools\scripts\win_add2path.py
Python_x86\Python27\Tools\scripts\win_add2path.py
Python_x86\Python33\Tools\scripts\win_add2path.py
{it was still running at the time of the above cut&paste, so no end prompt}
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
[toc] | [prev] | [next] | [standalone]
| From | Gisle Vanem <gvanem@yahoo.no> |
|---|---|
| Date | 2016-02-19 15:18 +0100 |
| Message-ID | <mailman.49.1455891656.2289.python-list@python.org> |
| In reply to | #103180 |
Dennis Lee Bieber wrote:
>>> How can one search for files with DOS?
>>
>> dir /s /b \*add2path.*
>>
>> ChrisA
>
> Or move to PowerShell...
>
> Windows PowerShell
> Copyright (C) 2009 Microsoft Corporation. All rights reserved.
>
> PS C:\Users\Wulfraed\Documents> Get-ChildItem -Path c:\ -Filter *add2path*
> -Name -Recurse
Clumsy IMHO. Try:
c:\> envtool --path *ipython*
Matches in %PATH:
12 Feb 2015 - 17:16:12: f:\ProgramFiler\Python27\Scripts\ipython-script.py
12 Feb 2015 - 17:16:12: f:\ProgramFiler\Python27\Scripts\ipython.exe
12 Feb 2015 - 17:16:12: f:\ProgramFiler\Python27\Scripts\ipython.exe.manifest
12 Feb 2015 - 17:16:12: f:\ProgramFiler\Python27\Scripts\ipython2-script.py
12 Feb 2015 - 17:16:12: f:\ProgramFiler\Python27\Scripts\ipython2.exe
12 Feb 2015 - 17:16:12: f:\ProgramFiler\Python27\Scripts\ipython2.exe.manifest
08 Feb 2015 - 12:48:56: f:\ProgramFiler\Python27\Scripts\ipython_win_post_install.py
7 matches found for "*ipython*".
-------------------
Or find a spec on *all partitions* using Everything Search engine:
c:\> envtool --evry *ipython*
Matches from EveryThing:
...
133 matches found for "*ipython*".
-------------------
Or for Python-path searches:
c:\> envtool --python *ipython*
Matches in "f:\ProgramFiler\Python27\python.exe" sys.path[]:
23 Jan 2016 - 13:50:30: f:\ProgramFiler\Python27\lib\site-packages\ipython-2.1.0-py2.7.egg\IPython\
23 Jan 2016 - 13:50:26: f:\ProgramFiler\Python27\lib\site-packages\IPython\
23 Jan 2016 - 13:50:30: f:\ProgramFiler\Python27\lib\site-packages\ipython-2.1.0-py2.7.egg\
3 matches found for "*ipython*".
-----
My envtool is at https://github.com/gvanem/EnvTool
EveryThing is at http://voidtools.com/
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | comp.lang.python
csiph-web