Batch Script Command

This is a discussion on Batch Script Command within the Tech Board forums, part of the Community Boards category; I'm trying to use batch to set an environment variable I use the command prompt a lot sometimes, and cygwin ...

  1. #1
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465

    Batch Script Command

    I'm trying to use batch to set an environment variable

    I use the command prompt a lot sometimes, and cygwin often, but often just the command prompt, so I am wondering how I might perform this task: add the current directory into the PATH environment variables

    In cygwin/bash, I can say

    PATH=$PATH;$($echo pwd) or something

    But in cmd I don't know what to do. I know that 'cd' can perform like 'pwd' but is there anyway I can do this using the 'set' command?

    ╔╗╔╦══╦╗╔╦══╦╗
    ║╚╝║╔╗║╚╝║╔╗║║
    ║╔╗║╠╣║╔╗║╠╣╠╣
    ╚╝╚╩╝╚╩╝╚╩╝╚╩╝

    codez http://code.google.com/p/zxcvbn/

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    A batch script like this would work:
    Code:
    path %path%;%1
    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    I stumbled through a lot of old dos websites before i discovered %cd% -- %1 isparameter and %0 is the program's name. I also downloaded the SP2 additional program for admins and it includes setx.exe for more control over environmental variables. More than set.exe at least. Your suggestion did lead me into this info, thanks matsp

    path=%path%;%cd%

    ╔╗╔╦══╦╗╔╦══╦╗
    ║╚╝║╔╗║╚╝║╔╗║║
    ║╔╗║╠╣║╔╗║╠╣╠╣
    ╚╝╚╩╝╚╩╝╚╩╝╚╩╝

    codez http://code.google.com/p/zxcvbn/

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 26
    Last Post: 07-05-2010, 10:43 AM
  2. using tar command in a shell script
    By rohan_ak1 in forum Linux Programming
    Replies: 1
    Last Post: 05-10-2008, 07:03 AM
  3. Replies: 0
    Last Post: 10-06-2007, 01:25 PM
  4. Batch file programming
    By year2038bug in forum Tech Board
    Replies: 10
    Last Post: 09-05-2005, 03:30 PM
  5. Game structure, any thoughts?
    By Vorok in forum Game Programming
    Replies: 2
    Last Post: 06-07-2003, 01:47 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21