Results 1 to 4 of 4

Thread: Help with .bat files

  1. #1
    Xtreme Member
    Join Date
    Jan 2007
    Location
    Lancaster, UK
    Posts
    473

    Help with .bat files

    Hi, was hoping some one could help me work out how to use a .bat file to run diskpart, and then input some commands.

    In other words I want to run diskpart, and then run some commands in diskpart using a .bat file.

    Is this possible, and if not is there any outher way of doing this?

    Sorry to be a bother.

  2. #2
    Xtreme X.I.P. Particle's Avatar
    Join Date
    Apr 2008
    Location
    Kansas
    Posts
    3,219
    I don't think you can do this in a batch file since it runs one item at a time, waits for its completion, and then runs another. It will launch diskpart alright, but it'll wait until it is closed before executing the next line. Often times, programs like that can take command-line switches where they will perform the action you want without user input being required. You should check for that. If so, you can make a batch file that will launch the program with the desired options required to perform the task you're after. A lot of times they will tell you what some of their common switches are by using the following:

    program.exe /?
    program.exe -?
    program.exe /help
    program.exe -help

    You may have to try a few variations. You can also search online. Yup, it looks like someone made a list with explanations available online.
    Particle's First Rule of Online Technical Discussion:
    As a thread about any computer related subject has its length approach infinity, the likelihood and inevitability of a poorly constructed AMD vs. Intel fight also exponentially increases.

    Rule 1A:
    Likewise, the frequency of a car pseudoanalogy to explain a technical concept increases with thread length. This will make many people chuckle, as computer people are rarely knowledgeable about vehicular mechanics.

    Rule 2:
    When confronted with a post that is contrary to what a poster likes, believes, or most often wants to be correct, the poster will pick out only minor details that are largely irrelevant in an attempt to shut out the conflicting idea. The core of the post will be left alone since it isn't easy to contradict what the person is actually saying.

    Rule 2A:
    When a poster cannot properly refute a post they do not like (as described above), the poster will most likely invent fictitious counter-points and/or begin to attack the other's credibility in feeble ways that are dramatic but irrelevant. Do not underestimate this tactic, as in the online world this will sway many observers. Do not forget: Correctness is decided only by what is said last, the most loudly, or with greatest repetition.

    Rule 3:
    When it comes to computer news, 70% of Internet rumors are outright fabricated, 20% are inaccurate enough to simply be discarded, and about 10% are based in reality. Grains of salt--become familiar with them.

    Remember: When debating online, everyone else is ALWAYS wrong if they do not agree with you!

    Random Tip o' the Whatever
    You just can't win. If your product offers feature A instead of B, people will moan how A is stupid and it didn't offer B. If your product offers B instead of A, they'll likewise complain and rant about how anyone's retarded cousin could figure out A is what the market wants.

  3. #3
    Xtreme Member
    Join Date
    Jan 2007
    Location
    Lancaster, UK
    Posts
    473
    Excellent, cheers for you help.

  4. #4
    Xtreme Addict
    Join Date
    Mar 2008
    Posts
    1,163
    Particle posted the best way, however it is possible add user input from a batch file. I'm not sure if everything can be done this way, but:
    Code:
    program.exe<input.txt
    input.txt is obviously what you'd write as a user. This way you have to predict everything that happens before you run it, if at some point there are 2 possible program behaviours, you've got a problem.
    Probably you can do this too, but it's certainly easier to learn C++ than do such things from a batch.

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •