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

This is a discussion on global program in cmd.exe / bin? / PATH? within the Windows Programming forums, part of the Platform Specific Boards category; Hey you know in linux you can type "ls" in a shell and it will exec the ls script that ...

  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
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,471
    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
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

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, 06: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

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