Batch file: how to start a program [sidebar.exe]

Page 1 of 2 12 LastLast

  1. Posts : 94
    Windows 7 Ultimate 64-bit
       #1

    Batch file: how to start a program [sidebar.exe]


    Hi! I need some help with a batch file I'm writing.

    Here's what I've got so far:

    Code:
    taskkill /F /IM sidebar.exe
    START "C:\Program Files (x86)\Windows Sidebar\sidebar.exe"
    The first line works great; it terminates sidebar.exe fine. But, the next line is the problem. It doesn't open up the sidebar.exe, but instead opens up a useless command prompt window:



    What am I doing wrong? I tried "....sidebar.exe \showgadgets" (some random argument I found online), but that does not work either. I also tried running the command via CMD, no luck. Tried CMD "Run As Administrator", no luck either.

    EDIT: If I navigate to the Windows Sidebar folder with cd, then from there I can just type "sidebar.exe" and it will run. But how do I do that in a batch file?

    Any ideas?

    ~Ibrahim~

    P.S. Also...if anyone knows how to run a batch command automatically when on battery, that'd be lovely. Any powercfg gurus here?
      My Computer


  2. Posts : 1,325
    Windows7 Ultimate 64bit
       #2

    change this line here:
    START "C:\Program Files (x86)\Windows Sidebar\sidebar.exe"

    to this line:
    "C:\Program Files (x86)\Windows Sidebar\sidebar.exe"

    zzz2496
      My Computer


  3. Posts : 94
    Windows 7 Ultimate 64-bit
    Thread Starter
       #3

    zzz2496 said:
    change this line here:
    START "C:\Program Files (x86)\Windows Sidebar\sidebar.exe"

    to this line:
    "C:\Program Files (x86)\Windows Sidebar\sidebar.exe"

    zzz2496
    Oh, crap, that does work! :)

    One little issue: it leaves a CMD prompt open. Any way to get it to auto-close?
      My Computer


  4. Posts : 1,325
    Windows7 Ultimate 64bit
       #4

    Add --> @echo off
    at the start of the file.

    zzz2496
      My Computer


  5. Posts : 94
    Windows 7 Ultimate 64-bit
    Thread Starter
       #5

    Sweet. Well, I'm almost there:

    No "@echo off" gives this command prompt
    Code:
    C:\Users\Ibrahim\Desktop>taskkill /F /IM sidebar.exe
    SUCCESS: The process "sidebar.exe" with PID 3724 has been terminated.
    
    C:\Users\Ibrahim\Desktop>"C:\Program Files (x86)\Windows Sidebar\sidebar.exe"
    @echo off in the first line unfortunately still gives a command prompt, but the output is a bit different:

    Code:
    SUCCESS: The process "sidebar.exe" with PID 6040 has been terminated.
    With @echo off, it looks like this:
    Code:
    @echo off
    taskkill /F /IM sidebar.exe
    "C:\Program Files (x86)\Windows Sidebar\sidebar.exe"
    But, right...I still get that "echo" from taskkill.

    EDIT: Adding ">nul" after the taskkill command stops any output. I can hide the whole window later. :) Thanks for the help!
      My Computer


  6. Posts : 966
    Windows 7 Enterprise
       #6

    add an 'exit' command at the very last line. Without the comma's of course.
      My Computer


  7. Posts : 1,325
    Windows7 Ultimate 64bit
       #7

    Here:
    Code:
    @echo off
    taskkill /F /IM sidebar.exe > NUL
    start "" "C:\Program Files (x86)\Windows Sidebar\sidebar.exe"
      My Computer


  8. Posts : 94
    Windows 7 Ultimate 64-bit
    Thread Starter
       #8

    zzz2496 said:
    Here:
    Code:
    @echo off
    taskkill /F /IM sidebar.exe > NUL
    start "" "C:\Program Files (x86)\Windows Sidebar\sidebar.exe"
    Woohoo!! That works perfectly.

    Thanks, man. +rep! Should've repped you from the first post, but I forgot and now I can only do it once.

    ~Ibrahim~
      My Computer


  9. Posts : 1,325
    Windows7 Ultimate 64bit
       #9

    You're welcome :) and thanks for the rep

    zzz2496
      My Computer


  10. Posts : 28,845
    Win 8 Release candidate 8400
       #10

    ikjadoon said:
    Hi! I need some help with a batch file I'm writing.

    Here's what I've got so far:

    Code:
    taskkill /F /IM sidebar.exe
    START "C:\Program Files (x86)\Windows Sidebar\sidebar.exe"
    The first line works great; it terminates sidebar.exe fine. But, the next line is the problem. It doesn't open up the sidebar.exe, but instead opens up a useless command prompt window:



    What am I doing wrong? I tried "....sidebar.exe \showgadgets" (some random argument I found online), but that does not work either. I also tried running the command via CMD, no luck. Tried CMD "Run As Administrator", no luck either.

    EDIT: If I navigate to the Windows Sidebar folder with cd, then from there I can just type "sidebar.exe" and it will run. But how do I do that in a batch file?

    Any ideas?

    ~Ibrahim~

    P.S. Also...if anyone knows how to run a batch command automatically when on battery, that'd be lovely. Any powercfg gurus here?

    Sidebar folder may not be included in your path statement
      My Computer


 
Page 1 of 2 12 LastLast

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 09:28.
Find Us