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

Author Topic: Batch file don't run in open dos window  (Read 6190 times)

0 Members and 1 Guest are viewing this topic.

wildmanjoe

    Topic Starter


    Starter

    • Experience: Beginner
    • OS: Unknown
    Batch file don't run in open dos window
    « on: January 21, 2012, 04:28:02 PM »
    Hello when i run this batch file I am unable to get it to popupate a list of pst files on the dos window, just brings up a empty dos window.


    @echo off
    CMD
    DIR /a /s | find ".pst"


    Also how do you get this command below to run in the Start -> RUN command line

    DEL /f /s /q %temp%

    Salmon Trout

    • Guest
    Re: Batch file don't run in open dos window
    « Reply #1 on: January 21, 2012, 05:32:09 PM »
    1.
    @echo off
    dir /a /s /b *.pst

    2.
    DEL /f /s /q "%temp%"

    wildmanjoe

      Topic Starter


      Starter

      • Experience: Beginner
      • OS: Unknown
      Re: Batch file don't run in open dos window
      « Reply #2 on: January 22, 2012, 07:25:16 AM »
      Thanks for the help,

      Worked!

      1.

      @echo off
      dir /a /s /b *.pst
      pause

      and

      2.

      Does not work in XP in the Start -> Run window.  Error Windows can not find DEL...

      DEL /f /s /q "%temp%"


      Salmon Trout

      • Guest
      Re: Batch file don't run in open dos window
      « Reply #3 on: January 22, 2012, 07:36:08 AM »
      Does not work in XP in the Start -> Run window.  Error Windows can not find DEL...

      DEL /f /s /q "%temp%"

      Sorry... I forgot it was the Run box...

      cmd /c DEL /f /s /q "%temp%"

      wildmanjoe

        Topic Starter


        Starter

        • Experience: Beginner
        • OS: Unknown
        Re: Batch file don't run in open dos window
        « Reply #4 on: January 22, 2012, 09:23:35 AM »
        Awesome! # 2 worked thanks again, last question i promise.

        I also want to run this in start -> run

        dir /a /s /b *.pst

        I did:  CMD /c dir /a /s /b *.pst

        But i am unable to figure out how to get it to pause after it generates a list of the PST files, the dos screen flashes and goes away quick. Noticed the pause command is for batch only and I am unable to locate the  " / a b c d e f " commands list anywhere on the net and find pause.

        Source:  http://technet.microsoft.com/en-us/library/bb490965.aspx
        « Last Edit: January 22, 2012, 10:16:58 AM by wildmanjoe »

        Salmon Trout

        • Guest
        Re: Batch file don't run in open dos window
        « Reply #5 on: January 22, 2012, 11:42:59 AM »

        I did:  CMD /c dir /a /s /b *.pst

        But i am unable to figure out how to get it to pause after it generates a list of the PST files


        (Please ignore the post above)

        I am showing some screen grabs this time... hope you can see them... this is what I typed... as you can see pause is not just for use in scripts.

        Code: [Select]
        CMD /c dir /a /s /b *.pst & pause


        « Last Edit: January 22, 2012, 12:03:53 PM by Salmon Trout »

        Squashman



          Specialist
        • Thanked: 134
        • Experience: Experienced
        • OS: Other
        Re: Batch file don't run in open dos window
        « Reply #6 on: January 22, 2012, 02:57:05 PM »
        You could also use the /K switch with the cmd processor.

        cmd /k dir /a-d /s /b *.pst
        « Last Edit: January 22, 2012, 03:35:09 PM by Squashman »

        Salmon Trout

        • Guest
        Re: Batch file don't run in open dos window
        « Reply #7 on: January 22, 2012, 03:31:07 PM »
        You could also use the /K switch with the cmd processo.

        cmd /k dir /a-d /s /b *.pst

        yes, you are right. I thought of this after I posted but you have beaten me...

        If you use /k then the there is no need for a pause because the command window will not close. This is better.



        wildmanjoe

          Topic Starter


          Starter

          • Experience: Beginner
          • OS: Unknown
          Re: Batch file don't run in open dos window
          « Reply #8 on: January 22, 2012, 05:17:02 PM »
          Nice! WOW, I was using the K at the end and it was asking me Y/N to run stuff so i didn't go thhat route, thanks again!