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

Author Topic: Notepad  (Read 4798 times)

0 Members and 1 Guest are viewing this topic.

usman.sialkot

  • Guest
Notepad
« on: October 31, 2008, 10:15:31 PM »
HI peoples!!!  8)

I want to create a batch file that when i click on it i format my USB drive easily.

I usually create bath file by going to notepad.

For formating the USB dirve i opened the notepad and typed

format I:

and saved it as format.bat. But when i cliked on it, the Dos asked for

confermation that r u sure to format.

so what would be the compleat code for foramting the USB by simply

clicking the batch file.

Thank you!

Skitz



    Rookie

    Re: Notepad
    « Reply #1 on: November 01, 2008, 12:02:03 AM »
    Code: [Select]
    @echo off
    FORMAT /X /FS:FAT32 /Q /V:USB I:

    That should do the trick. There is no way around pressing enter, >yes won't work either since it doesn't even ask to confirm...
    « Last Edit: November 02, 2008, 01:26:51 AM by Skitz »
    We hackers are pioneers, explorers, inventors, technological masterminds, we hackers, are the superior few, that exist among the human race...

    Geek-9pm


      Mastermind
    • Geek After Dark
    • Thanked: 1026
      • Gekk9pm bnlog
    • Certifications: List
    • Computer: Specs
    • Experience: Expert
    • OS: Windows 10
    Re: Notepad
    « Reply #2 on: November 02, 2008, 12:01:38 AM »
    WOW! that  is amazing.  :o To get it to work without even hitting a key, have it take input from a  file with a single char. Make a  text file with just the letter 'Y' in it and save it as 'YES' and then put this on the end of the command.
    >YES
     ::)

    usman.sialkot

    • Guest
    Re: Notepad
    « Reply #3 on: November 02, 2008, 01:21:33 AM »
    and then put this on the end of the command.
    >YES


    i tried this last line but i didnt work. Would you please explain this in detail

    i have made text file on desktop and then typed Yes in it and saved it as

    YES. then i edit the batch file and typed

    >yes on the last line and then save it .....

    but it's still asking me for and press ENTER when ready


    Skitz



      Rookie

      Re: Notepad
      « Reply #4 on: November 02, 2008, 01:23:44 AM »
      The code I supplied doesn't request you to answer yes or no. You must press enter to start the format. Geek-9pm has made a mistake, >YES simply won't work.
      « Last Edit: November 02, 2008, 10:43:58 PM by Skitz »
      We hackers are pioneers, explorers, inventors, technological masterminds, we hackers, are the superior few, that exist among the human race...

      Sidewinder



        Guru

        Thanked: 139
      • Experience: Familiar
      • OS: Windows 10
      Re: Notepad
      « Reply #5 on: November 02, 2008, 03:46:30 AM »
      The code I supplied doesn't request you to answer yes or no. You must press enter to start the format. Geek-9pm has made a mistake, >YES simply won't work. As I stated before, there is no way around it.

      You can input the enter key by using the pipe:

      Code: [Select]
      @echo off
      ECHO. | FORMAT /X /FS:FAT32 /Q /V:USB I:

      Maybe it's just me, but when running destructive programs, I prefer to use the command line where I can see what I'm doing.  8)
      The true sign of intelligence is not knowledge but imagination.

      -- Albert Einstein

      usman.sialkot

      • Guest
      Re: Notepad
      « Reply #6 on: November 02, 2008, 08:49:12 PM »
      Sidewinder you are genius all i can say

      Thank you very much.God bless you   8)

      Skitz



        Rookie

        Re: Notepad
        « Reply #7 on: November 02, 2008, 10:46:20 PM »
        Years of experience with DOS and I couldn't think of something that simple. Having OCD is really annoying, since it causes complex thinking patterns, I never seem to be able to see simple things. It also makes you think that a lot of things are impossible, hence me saying "There is no way around it". Nice, sidewinder.
        « Last Edit: November 03, 2008, 02:45:09 AM by Skitz »
        We hackers are pioneers, explorers, inventors, technological masterminds, we hackers, are the superior few, that exist among the human race...

        Geek-9pm


          Mastermind
        • Geek After Dark
        • Thanked: 1026
          • Gekk9pm bnlog
        • Certifications: List
        • Computer: Specs
        • Experience: Expert
        • OS: Windows 10
        Re: Notepad
        « Reply #8 on: November 03, 2008, 10:42:00 PM »
        Hwy, that is cool.  8) Using a pipe with echo. Never would have thought of that!
        As to may missnaake..era ahh mistook.. You know what I mean.
        Quote
        and then put this on the end of the command.
        >YES
        YES is a text file named YES, but not YES.TXT and it has only cone char. For me a letter Y would do, but if your system has to have ENTER, then one blank line. I have been using that for yeas in DOS  commands where you press any key or the letter Y.
        Oh well, the Echo pipe is much more elegant and I like it better. :D

        Sidewinder



          Guru

          Thanked: 139
        • Experience: Familiar
        • OS: Windows 10
        Re: Notepad
        « Reply #9 on: November 04, 2008, 03:55:19 AM »
        Quote
        Oh well, the Echo pipe is much more elegant and I like it better

        Unfortunately, the pipe is only helpful for a single input. Geek was right about redirection except the direction of the redirection was misdirected  ;)  Redirection works provided the contents of the response file are synchronized to the prompts:

        Code: [Select]
        FORMAT /X /FS:FAT32 /Q I: < YES

        The YES file would contain:

        Code: [Select]

        USB

        The first line (blank) responds to:
        Quote
        Insert new disk for drive I:
        and press ENTER when ready... The type of the file system is FAT32

        The second line responds to:
        Quote
        Volume label (11 characters, ENTER for none)?

        One technique would be to have the batch file create the response file ahead of running the utility:
        Code: [Select]
        echo.>YES
        echo USB>>YES
        format /X /FS:FAT32 /Q I: < YES

         8)

        The true sign of intelligence is not knowledge but imagination.

        -- Albert Einstein

        ALAN_BR



          Hopeful

          Thanked: 5
          • Computer: Specs
          • Experience: Experienced
          • OS: Windows 7
          Re: Notepad
          « Reply #10 on: November 04, 2008, 04:53:43 AM »
          Maybe it's just me, but when running destructive programs, I prefer to use the command line where I can see what I'm doing.  8)

          I agree.

          Caution -
          Is I:\ always going to be the USB drive that needs formatting ?
          If this batch file is launched when a relative's IPOD is plugged in, could they lose all their music ?
          (Same with a friend's IPOD, except they won't remain friends !!!)

          Regards
          Alan