Quantcast
Results 1 to 5 of 5

.bat files for new users

  1. #1
    travisthedrumer is offline Junior Member
    Enjoys Windows 7 Forums
     
    Join Date
    Nov 2010
    Posts
    1

    .bat files for new users

    So, I just got Windows 7, and I love it more than I love Linux. I think it was the ads for it. -.-

    When I had XP, I learned how to make simple batch files. nothing major, just something to bid my time while in class.

    I just mastered the "IF" command, and now I want to try and see if I can expand on that.

    IF EXIST C:\Users\Travis\Documents\Batchfiles\oinker.txt (
    del C:\Users\Travis\Documents\Batchfiles\oinker.txt
    ) ELSE (
    echo Delete function is a failure.
    )

    that's what i have, and mind you, I am not a programmer by any means. I just love computers and google is my friend.

    I want to make the if command search for an running program, say notepad.exe. What would be the command for that?

    And can someone explain ERRORLEVEL to me? All I can find on google or anywhere else is what it does, but I dont understand the meanings of 1,2,3....

    Any help would be appreciated.

    Like I said, no programmer, just a mechanical engineering student who gets bored in math class.

    ALSO:: this is all being in notepad. no special programs, just notepad
    Last edited by travisthedrumer; 11-13-2010 at 03:47 AM. Reason: forgot something

    Reply With Quote Reply With Quote

  2. #2
    Josephur's Avatar
    Josephur is offline Senior Member
    Enjoys Windows 7 Forums
     
    Join Date
    Aug 2010
    Age
    32
    Posts
    103
    Blog Entries
    1

    Re: .bat files for new users

    tasklist /FI "IMAGENAME eq myapp.exe" 2>NUL | find /I /N "myapp.exe">NUL
    if "%ERRORLEVEL%"=="0" echo Programm is running

    You can read about ERRORLEVEL here: ERRORLEVEL is not %ERRORLEVEL% - The Old New Thing - Site Home - MSDN Blogs

    Reply With Quote Reply With Quote

  3. #3
    kaos's Avatar
    kaos is offline Senior Member
    BSOD's,batch scripts bring em
    on
     
    Join Date
    May 2011
    Posts
    876

    Re: .bat files for new users

    therer is loads you can do with basic programming, some fun stuff too, i got a fair few commands n programs i wrote such as creating a login with user name and passwword then if you get it right it can take you to list of commands you can write or if you get the username and password wrong it can execute other commands

    the options are endless



    let me no if you want help with ,bat files.... i understand that thy can be usefull and feel really good when you completed your own little scripts

    Reply With Quote Reply With Quote

  4. #4
    msfanboy98's Avatar
    msfanboy98 is offline Senior Member
    Enjoys Windows 7 Forums
     
    Join Date
    May 2011
    Age
    14
    Posts
    118

    Re: .bat files for new users

    I remember scamming my friend with shutdown -c. lol

    Reply With Quote Reply With Quote

  5. #5
    AceInfinity's Avatar
    AceInfinity is offline Member
    Computer Mainstream Pro
     
    Join Date
    Aug 2011
    Posts
    46

    Re: .bat files for new users

    If you want to start notepad:
    Code:
    start notepad.exe
    No need for a filepath because it's in the %SystemRoot% directory.

    If you're going to be using the ErrorLevel variable, you want to be saving your script with the .cmd file extension instead so that it gets executed first.

    "%ERRORLEVEL%"=="0"

    Just means that no true error was returned.

    Reply With Quote Reply With Quote

Similar Threads

  1. Best practice for file share containing log files from users
    By TheDigitalJedi in forum Windows Server
    Replies: 0
    Last Post: 02-25-2011, 03:02 PM
  2. [ACCOUNTS] Move c:\users to d:\users
    By perry59 in forum Windows 7 Support
    Replies: 3
    Last Post: 01-30-2011, 09:15 PM
  3. Replies: 6
    Last Post: 10-06-2010, 03:21 PM
  4. Replies: 0
    Last Post: 08-11-2010, 08:52 PM
  5. Files Viewable by All Users
    By bauer24 in forum Windows 7 Support
    Replies: 1
    Last Post: 12-14-2009, 05:38 PM

Visitors found this page by searching for:

where are the bat andminf files on win 7

Tags for this Thread

Posting Permissions

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