Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #103072

Re: extending PATH on Windows?

Path csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From eryk sun <eryksun@gmail.com>
Newsgroups comp.lang.python
Subject Re: extending PATH on Windows?
Date Wed, 17 Feb 2016 15:17:46 -0600
Lines 41
Message-ID <mailman.222.1455743909.22075.python-list@python.org> (permalink)
References <n9umo3$9lg$1@news2.informatik.uni-stuttgart.de> <mailman.160.1455625190.22075.python-list@python.org> <n9v58k$dcl$1@news2.informatik.uni-stuttgart.de> <mailman.168.1455630261.22075.python-list@python.org> <na2bqn$7d7$1@news2.informatik.uni-stuttgart.de> <mailman.217.1455735785.22075.python-list@python.org> <na2l7h$a97$1@news2.informatik.uni-stuttgart.de>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de YNR3nOr1/TCSjoMm++lnFAd+SbthmAaqdXdEYOZkt0xw==
Return-Path <eryksun@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'operator': 0.03; 'modify': 0.04; 'append': 0.07; 'shortcut': 0.07; 'subject:Windows': 0.09; 'any.': 0.09; 'command.': 0.09; 'operator,': 0.09; 'overwrite': 0.09; 'path)': 0.09; 'script,': 0.09; ':-)': 0.12; 'wed,': 0.15; 'value.': 0.15; '"&"': 0.16; "(it's": 0.16; '2016': 0.16; 'concatenate': 0.16; 'executed,': 0.16; 'function?': 0.16; 'parentheses': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'registry': 0.16; 'wrote:': 0.16; 'cc:2**0': 0.20; 'machine': 0.21; 'parse': 0.22; 'simpler': 0.22; "user's": 0.22; 'feb': 0.23; 'header:In-Reply-To:1': 0.24; 'script': 0.25; 'install': 0.25; 'command': 0.26; 'message-id:@mail.gmail.com': 0.27; 'this.': 0.28; 'exists,': 0.29; 'path,': 0.29; 'starts': 0.29; 'that.': 0.30; 'too.': 0.30; 'e.g.': 0.30; 'query': 0.30; 'another': 0.32; "can't": 0.32; 'run': 0.33; 'thanks!': 0.34; 'file': 0.34; 'previous': 0.34; 'gets': 0.35; 'received:google.com': 0.35; 'instance': 0.35; 'path': 0.35; 'skip:p 30': 0.35; 'but': 0.36; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'received:209.85.213': 0.37; "won't": 0.38; 'received:209': 0.38; 'why': 0.39; 'to:addr:python.org': 0.40; 'still': 0.40; 'your': 0.60; 'export': 0.63; 'more': 0.63; 'legal': 0.66; 'prompt': 0.79
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=qOu/hO71i2Wf+3wNvJsVCgidpsSKdl0YbRGOgo7Hoxg=; b=w9i2/EsrgJ8bQk32By1pMKMDjOpcx7y1V6IxRpgam2YJmSct9yaYod7ToFmOnIh5sF nHc8uMUDnHm5IAF9Fh9rwPOv6Gxyq/KrlG9Y++OweSUJOoNSrj9f4uRfUwYi+2M426Tg lBHLy7NpA9gofke8fIU7MWEcWMYhhqncrXzpcGO4YG1s29mYu7pmMqUXjEdT4Sv7SPNM ZF+jJOsSwwcxfV/6spd3glLfP3phu0JiN0NkTJmh5v2i/MRVtekye5KXGbLuFDZcSHPp DNcJXQ144kgh4ksw7afeY9rH+n4fuPImD0x3wMiCjMOXOeniohAaBRqFkp/90MMOHCph e6Dw==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=qOu/hO71i2Wf+3wNvJsVCgidpsSKdl0YbRGOgo7Hoxg=; b=WT6VLYNR5/pdRCo7adkl/LXH1jTEix8Ws0UmDBDgHZSrWQbVrii+46SSJTXDzOOK5S h6WkWnhV4NZDoNjd/jZe9yMhvJdoKbdxsq7yABsqgEcHE3Bbe0sc5ngSw3ICENqa6sMT RRLrT4PTUW2YMgpUsyftdqWAKT6XL/WOX9a1YanyVOlK4vCNh8hNSXLzrlR3lETtQfOd laN3glF30cEk9sb23TSnFJE73WJKTj2x8rTl2jNHReX3AAE0XGfiU88etQ+o5X1HrIh2 e+Mn5+hozceXZKYrhXFttdY5X+m44jPvnthF+reyaYah+sM8QfI3eVPEQa2OKmkdAbbP /Mgg==
X-Gm-Message-State AG10YOQEAKZSSbY7nI0jd6J00vjJa4C957cP6pVyamJT534HAqzk0d2W5L//kbFroPfCiqMwaTVCUqa6LHgmFg==
X-Received by 10.50.222.98 with SMTP id ql2mr9460717igc.55.1455743906548; Wed, 17 Feb 2016 13:18:26 -0800 (PST)
In-Reply-To <na2l7h$a97$1@news2.informatik.uni-stuttgart.de>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.21rc2
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:103072

Show key headers only | View raw


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.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

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

csiph-web