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


Groups > comp.lang.python > #103062

Re: extending PATH on Windows?

Path csiph.com!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 13:02:21 -0600
Lines 26
Message-ID <mailman.217.1455735785.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>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de flhnBPlqb3vL5N9yRdAg6g6s3HN4TLHFodMQMz8hIbpg==
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; 'received:209.85.223': 0.03; 'startup': 0.05; 'exit': 0.07; 'subject:Windows': 0.09; '"%s"': 0.09; '"%s"\'': 0.09; 'cmd': 0.09; 'operator,': 0.09; 'overwrite': 0.09; 'path)': 0.09; 'wed,': 0.15; '"&"': 0.16; "(it's": 0.16; '2016': 0.16; 'concatenate': 0.16; 'parentheses': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'registry': 0.16; 'sentinel': 0.16; 'set,': 0.16; 'wrote:': 0.16; 'runs': 0.18; 'variable': 0.18; 'cc:2**0': 0.20; 'skip:" 30': 0.20; "user's": 0.22; 'am,': 0.23; 'defined': 0.23; 'feb': 0.23; 'header :In-Reply-To:1': 0.24; 'script': 0.25; 'command': 0.26; 'message- id:@mail.gmail.com': 0.27; 'this.': 0.28; 'exists,': 0.29; 'extending': 0.29; 'that.': 0.30; 'e.g.': 0.30; "can't": 0.32; 'run': 0.33; 'option.': 0.33; 'file': 0.34; 'add': 0.34; 'that,': 0.34; 'gets': 0.35; 'received:google.com': 0.35; 'instance': 0.35; 'path': 0.35; 'skip:p 30': 0.35; 'received:209.85': 0.36; 'to:addr :python-list': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'done.': 0.37; 'received:209': 0.38; 'to:addr:python.org': 0.40; 'your': 0.60
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=c28Xm9CAiASo0ExkNqPzb+I6GYkahIVMUdj8Gz2gMPA=; b=pUfSmGoegxJ2jTBfEuygVoEqZolru5X3bPyiEF0/PssBgHDralYpc79gX6cgWwH3iM WJ4o8QDVDvRgwQAXS9hs99zm7kmt4gkGqea618p2nA3A/MQIi1pnosbMTWbcL5v8Gtp0 soM6hZ44m2IuCpZwr+Q+2+cC6hyWkXIFpveYISjlVVUYHcWyuwzGTwWZxlWSNW0dqhGA qEiJPrv4480zWLJrZuCNlyr86+a0z7ww64xqfITYFYupB4eXXnZ1VwGBSJlzaF6ETl4B Si3ROomWbbtRyL7Zz7M3dNkvbT7AEg+IyGmb8n1PrSEIwVShECw/+tLaWdaqzq/bVEtJ 0lCw==
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=c28Xm9CAiASo0ExkNqPzb+I6GYkahIVMUdj8Gz2gMPA=; b=Zk8rTJs+VkiFKL0q1CxHt9kg/oe6prqm0LQQ3VznctygTKuKPuyiZDiTVmvSq793vR mpoDfN6dOS/RrSnqcD4q5XzaAjy6Qzngq883efPOBPQRSvJSCYctwMoEWgobpM9NOLZi kim4HNND/fKiausndGhhwZVgTCgEYx2fwMAK3M73npmOAXc8EsR41K98ex1zviGWhwYP Q5F64g64sF/pgPpMLdoZAcSUpuyiKJc1FpS5GIILimjss1ixx+zHDpiQvwCTAahXP+7l CtmmafmwzFLV7tXHBBBlrTjP2WZD/6LlS8g3FVh4rFzhLXhZQLYm0jf1wWOhd0bSI+Ed vZYQ==
X-Gm-Message-State AG10YORMjhlyv+m6x3q5FdDOutUauBPQhoD9YW9YNSpRYsBsUUttQI+Vc9SztM/BWi2haEGkGmPoG0wuei8JTQ==
X-Received by 10.107.10.158 with SMTP id 30mr4786351iok.73.1455735781421; Wed, 17 Feb 2016 11:03:01 -0800 (PST)
In-Reply-To <na2bqn$7d7$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:103062

Show key headers only | View raw


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.

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