Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7412673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:34:44+00:00 2026-05-29T06:34:44+00:00

I am writing installation in a Makefile in which I need to set the

  • 0

I am writing installation in a Makefile in which I need to set the PATH env. variable.

In the windows part of it, I found the following:

  • set: With set PATH="%PATH%;%CD%" I can change the PATH inside the running environment. There are two problems with this:
    • The environment is a spawned cmd.exe by make which gets its variable affected and the effect removed as soon as it closes
    • Even if the previous problem could be solved, still the cmd.exe that calls make would close one day and the modified PATH lost.
  • setx: A microsoft tool that can permanently change env. variables. According to microsoft itself, this is the only command-line option to do this. Using setx PATH "%PATH%;%CD%" -m however, turns path into the literal %PATH%;%CD% and doesn’t replace the variables by their contents!

Note that I am calling make from cmd.exe not cygwin or other modified windows shells that act more like linux. What I’m saying is that, although I can use $(PATH) in my makefile (instead of %PATH%), I can’t use pwd (instead of %CD%)

Also note that if in cmd itself I run:

setx PATH "%PATH%;%CD%" -m

it works perfectly. Somehow I need to make make execute this command.

Do you have any idea how to fix this, or what workaround do I have?

P.S. Just for the record, echo "%PATH%;%CD%" in the Makefile also echoes the literal "%PATH%;%CD%" rather than let cmd.exe handle it

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T06:34:44+00:00Added an answer on May 29, 2026 at 6:34 am

    Workaround:

    Create a .bat file, put the command there, and invoke it from the Makefile.

    I still am interested in a direct fix in the Makefile though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing installation script for my program, which is supposed to run on
Let's say I am writing installation script for the program which contains executable file
I am writing a Makefile which needs to figure out the directory of an
I'm writing a windows application in c#,FW3.5 & Visual Studio 2008. I need to
I'm writing a CESetup.dll for a Windows Mobile app. It must be unmanaged, which
Well I'm stumped. I'm writing an installation support add-on for Smart Install Maker that
I'm writing a console application that will be deployed with an installation of an
My application throws 'Access denied' errors when writing temporary files in the installation directory
Writing htaccess that allows me to remove index.php from the URL can confuse search
I'm writing a wix installer and I need to test the reinstall process. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.