Thread: global program in cmd.exe / bin? / PATH?

  1. #1
    Registered User
    Join Date
    Jan 2007
    Posts
    40

    global program in cmd.exe / bin? / PATH?

    Hey you know in linux you can type "ls" in a shell and it will exec the ls script that lists files/folders blah blah. Anyways, you can call that in any dir.

    I wrote a c++ file that does the same thing as 'cat' in linux, but I want to be able to call 'cat myfile.txt' anywhere within the windows shell cmd / command.com and it will execute my program.

    Is there any possible way to do this? Does it have something to do with the registry / PATH or a windows-like bin?

    Yes, I know there are *nix shell ports for win32 out there, but I'd like to use my own scripts.

  2. #2
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    open cmd
    type:
    set path

    if you put your program in one of the listed directories it wil be found by windows aotomatically
    or
    if you enter the envirounment settings and add the directory with your program to to list of the PATH variable the program also will be found automatically

    Note that the directories are searched in the order they are listed, so naming a program as some system program can be potentially dangerous
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Program Plan
    By Programmer_P in forum C++ Programming
    Replies: 0
    Last Post: 05-11-2009, 01:42 AM
  2. Need help with my program...
    By Noah in forum C Programming
    Replies: 2
    Last Post: 03-11-2006, 07:49 PM
  3. simple frontend program problem
    By gandalf_bar in forum Linux Programming
    Replies: 16
    Last Post: 04-22-2004, 06:33 AM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM