Batch File Fun

Discussion in 'Software' started by PrivatePile, Apr 20, 2012.

  1. PrivatePile

    PrivatePile Private E-2

    So I'm starting to learn some basic batch file stuff and I'll admit that I'm not very good. Hopefully someone can help me. My ideal solution would be to have a USB drive, that when plugged in will start running applications sequentially. I've already adopted Ninite to install programs for me, and I'd like for the script to start running the programs immediately after each other. So I would like the USB to be plugged in, immediately run Ninite installer, then run Program 1, when that finishes run Program 2, etc. And then I would like a second batch that will uninstall all the said programs. So here are my questions

    1. I know how to get the batch to run an individual program, but I was wondering how to make the batch run sequentially, waiting for the prior program to finish before starting.

    2. Is there a way to create a batch that will uninstall several programs. If it could be dynamic by uninstalling anything installed within the past 24 hours that would be great, but I would be happy if I determined which programs got uninstalled. And can this be done w/o user interaction?

    3. Does anyone know of a good website that gives you a good tutorial of creating your own batch files?

    4. Is it still possible to create the autorun.inf to auto-launch programs upon USB plug-in?
     
  2. GermanOne

    GermanOne Guest

    1.
    Code:
    start "" /wait "yourInstall.exe" [comand line options]
    2.
    No, there is no universal uninstaller.
    • If you know what folders/files/shortcuts were created, what libraries were registered, what registry keys where created or changed etc. then you could undo that step by step.
    • If these programs came with an uninstaller you can run it. It depends on the developer of the software whether or not he implemented a command line option to run it silently though.

    3.
    I'm not a native English. Hence I know some German tutorials but I'm afraid that doesn't help.

    4.
    Depends on what OS you're working. On XP it was possible to reactivate the autorun for removable drives. I'm virtually certain it's completely disabled/removed on Vista and newer versions due to security leaks.

    Regards
    GermanOne
     
  3. foogoo

    foogoo Major "foogoo" Geek

    maybe these can help
    http://www.tarma.com/support/uninstall.htm
    and nircmd (nirsoft.net) has a wait command
    Wait until Firefox is closed, and then say "Firefox was closed"
    waitprocess firefox.exe speak text "Firefox was closed"
     
  4. PrivatePile

    PrivatePile Private E-2

    Does the /wait still work in Windows 7? I tried it and it doesn't seem to take effect. I read online it appears that the /wait command was removed in Windows 7, which makes this painfully troublesome. Here is what I have so far, maybe you can help me out.

    Code:
     
    @echo off 
    :: variables 
    /min
    cd %userprofile%\desktop\VR USB Drive
    start Toolbox.exe <---- my Ninite installer
    start ccleaner.bat
    start mbam.bat
    For testing, i'm running it off my desktop but to run it off my flash drive I would change %userprofile% to %drive% correct?
     
  5. GermanOne

    GermanOne Guest

    I don't know where you heard that the /wait option (it's not a command) is removed on Win7. I'm on Win7 and it works fine for me. Have a look at the help message for that command (type START /? into the command prompt and hit Enter).

    What is the /min good for? (I guess it would display an error message.)

    If you have spaces in your path you have to enclose the path in qoutation marks. If the drive letter differs from the current drive you have to use option /d.
    Code:
    cd /d "x:\wherever\VR USB Drive"
    Use the syntax I wrote if you need to START something.
    Don't use START for other Batch files because the new window won't close if the Batch code reaches the end. Try the CALL command instead. If you need to START a Batch file for whatever reason use
    Code:
    start "" /wait cmd /c "your file.bat"
    Regards
    GermanOne
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds