C Board  

Go Back   C Board > Community Boards > Tech Board

Reply
 
LinkBack Thread Tools Display Modes
Old 11-20-2008, 03:58 AM   #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/
Tonto is offline   Reply With Quote
Old 11-20-2008, 05:24 AM   #2
Kernel hacker
 
Join Date: Jul 2007
Location: Farncombe, Surrey, England
Posts: 15,686
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.
matsp is offline   Reply With Quote
Old 11-20-2008, 07:33 AM   #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/
Tonto is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to sort a simple linked list using swap-sort method JOCAAN C Programming 24 08-07-2009 11:48 AM
using tar command in a shell script rohan_ak1 Linux Programming 1 05-10-2008 07:03 AM
Use of threads or state machines to synchronize command execution daluu C# Programming 0 10-06-2007 01:25 PM
Batch file programming year2038bug Tech Board 10 09-05-2005 03:30 PM
Game structure, any thoughts? Vorok Game Programming 2 06-07-2003 01:47 PM


All times are GMT -6. The time now is 04:32 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

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