Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: How do i make a CMD Prompt..??  (Read 7952 times)

0 Members and 1 Guest are viewing this topic.

gumbaz

    Topic Starter


    Intermediate

    How do i make a CMD Prompt..??
    « on: May 01, 2009, 08:39:16 PM »
    I need to make a prompt in my BAT Script to ask for a Directory Location and then set that location as a variable.. how can i do this..??

    gh0std0g74



      Apprentice

      Thanked: 37
      Re: How do i make a CMD Prompt..??
      « Reply #1 on: May 01, 2009, 09:21:14 PM »
      you have 180 posts, i seriously doubt you can't do it yourself by now. why don't you try your best?

      gumbaz

        Topic Starter


        Intermediate

        Re: How do i make a CMD Prompt..??
        « Reply #2 on: May 01, 2009, 09:47:48 PM »
        what functions or whatever, am i suppose yo use..??

        Dias de verano

        • Guest
        Re: How do i make a CMD Prompt..??
        « Reply #3 on: May 02, 2009, 12:12:07 AM »
        After 180 posts, gumbaz, you lose the magic "I am a n00b" card.

        billrich

        • Guest
        Re: How do i make a CMD Prompt..??
        « Reply #4 on: May 02, 2009, 02:50:14 AM »
        Start, run [ cmd ]
        or

        start, All Programs, Accessories, click Command Prompt
        or

        While at the Command Prompt, type cmd



        C:\>type old.bat
        Code: [Select]
        @echo off
        REM  Variables are Global unless declared Local
        set OLDDIR=%CD%
        echo Hello
        cmd /c
        echo new prompt
        cd %systemroot%
        echo CD  %CD%
        echo OldDir  %OLDDIR%
        echo return to old prompt
        echo CD  %CD%
        cd %HOMEPATH%
        echo %CD%
        chdir /d %OLDDIR% &rem restore current directory
        echo OldDir  %OLDDIR%
        Output:

        C:\>old.bat
        Quote
        Hello
        new prompt
        CD  C:\WINDOWS
        OldDir  C:\
        return to old prompt
        CD  C:\WINDOWS
        C:\Documents and Settings\Bill Richardson
        OldDir  C:\
        C:\>
        « Last Edit: May 02, 2009, 10:54:21 AM by billrich »

        billrich

        • Guest
        Re: How do i make a CMD Prompt..??
        « Reply #5 on: May 02, 2009, 02:53:23 AM »

        C:\>cmd /?
        Starts a new instance of the Windows XP command interpreter

        CMD [/A | /U] [/Q] [/D] [/E:ON | /E:OFF] [/F:ON | /F:OFF] [/V:ON | /V:OFF]
            [[/S] [/C | /K] string]

        /C      Carries out the command specified by string and then terminates
        /K      Carries out the command specified by string but remains
        /S      Modifies the treatment of string after /C or /K (see below)
        /Q      Turns echo off
        /D      Disable execution of AutoRun commands from registry (see below)
        /A      Causes the output of internal commands to a pipe or file to be ANSI
        /U      Causes the output of internal commands to a pipe or file to be
                Unicode
        /T:fg   Sets the foreground/background colors (see COLOR /? for more info)
        /E:ON   Enable command extensions (see below)
        /E:OFF  Disable command extensions (see below)
        /F:ON   Enable file and directory name completion characters (see below)
        /F:OFF  Disable file and directory name completion characters (see below)
        /V:ON   Enable delayed environment variable expansion using ! as the
                delimiter. For example, /V:ON would allow !var! to expand the
                variable var at execution time.  The var syntax expands variables
                at input time, which is quite a different thing when inside of a FOR
                loop.
        /V:OFF  Disable delayed environment expansion.

        Note that multiple commands separated by the command separator '&&'
        are accepted for string if surrounded by quotes.  Also, for compatibility
        reasons, /X is the same as /E:ON, /Y is the same as /E:OFF and /R is the
        same as /C.  Any other switches are ignored.

        If /C or /K is specified, then the remainder of the command line after
        the switch is processed as a command line, where the following logic is
        used to process quote (") characters:

            1.  If all of the following conditions are met, then quote characters
                on the command line are preserved:

                - no /S switch
                - exactly two quote characters
                - no special characters between the two quote characters,
                  where special is one of: &<>()@^|
        Press any key to continue . . .

        Dias de verano

        • Guest
        Re: How do i make a CMD Prompt..??
        « Reply #6 on: May 02, 2009, 02:53:29 AM »
        Billrich clearly didn't read gumbaz's question properly.


        Carbon Dudeoxide

        • Global Moderator

        • Mastermind
        • Thanked: 169
          • Yes
          • Yes
          • Yes
        • Certifications: List
        • Experience: Guru
        • OS: Mac OS
        Re: How do i make a CMD Prompt..??
        « Reply #7 on: May 02, 2009, 03:54:24 AM »
        A high post count does not mean you know more than everyone else.

        Dias de verano

        • Guest
        Re: How do i make a CMD Prompt..??
        « Reply #8 on: May 02, 2009, 04:23:39 AM »
        A high post count does not mean you know more than everyone else.

        Was that directed at me?

        Carbon Dudeoxide

        • Global Moderator

        • Mastermind
        • Thanked: 169
          • Yes
          • Yes
          • Yes
        • Certifications: List
        • Experience: Guru
        • OS: Mac OS
        Re: How do i make a CMD Prompt..??
        « Reply #9 on: May 02, 2009, 04:24:51 AM »

        Dias de verano

        • Guest
        Re: How do i make a CMD Prompt..??
        « Reply #10 on: May 02, 2009, 04:26:30 AM »
        Not you, no.

        I hoped not. Please forgive me for misjudging you.

        gh0std0g74



          Apprentice

          Thanked: 37
          Re: How do i make a CMD Prompt..??
          « Reply #11 on: May 02, 2009, 05:49:47 AM »
          who cares about post count ?

          Dias de verano

          • Guest
          Re: How do i make a CMD Prompt..??
          « Reply #12 on: May 02, 2009, 05:55:28 AM »
          who cares about post count ?

          It may be relevant in making certain assessments regarding a poster.

          Carbon Dudeoxide

          • Global Moderator

          • Mastermind
          • Thanked: 169
            • Yes
            • Yes
            • Yes
          • Certifications: List
          • Experience: Guru
          • OS: Mac OS
          Re: How do i make a CMD Prompt..??
          « Reply #13 on: May 02, 2009, 05:58:41 AM »
          who cares about post count ?

          you have 180 posts, i seriously doubt you can't do it yourself by now. why don't you try your best?

          macdad-



            Expert

            Thanked: 40
            Re: How do i make a CMD Prompt..??
            « Reply #14 on: May 02, 2009, 06:00:43 AM »
            Gumbaz,

            Code: [Select]
            @echo off
            echo Please enter a directory:
            set /p indir=
             ;)

            Hope this helps
            ,Nick(macdad-)
            If you dont know DOS, you dont know Windows...

            Thats why Bill Gates created the Windows NT Family.