Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


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

30 May 2010   #1
ikjadoon

Windows 7 Ultimate 64-bit
 
 
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 System SpecsSystem Spec
.
30 May 2010   #2
zzz2496

Windows7 Ultimate 64bit
 
 

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 System SpecsSystem Spec
30 May 2010   #3
ikjadoon

Windows 7 Ultimate 64-bit
 
 

Quote   Quote: Originally Posted by zzz2496 View Post
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 System SpecsSystem Spec
.

30 May 2010   #4
zzz2496

Windows7 Ultimate 64bit
 
 

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

zzz2496
My System SpecsSystem Spec
30 May 2010   #5
ikjadoon

Windows 7 Ultimate 64-bit
 
 

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 System SpecsSystem Spec
30 May 2010   #6
xarden

Windows 7 Enterprise
 
 

add an 'exit' command at the very last line. Without the comma's of course.
My System SpecsSystem Spec
30 May 2010   #7
zzz2496

Windows7 Ultimate 64bit
 
 

Here:
Code:
@echo off
taskkill /F /IM sidebar.exe > NUL
start "" "C:\Program Files (x86)\Windows Sidebar\sidebar.exe"
My System SpecsSystem Spec
30 May 2010   #8
ikjadoon

Windows 7 Ultimate 64-bit
 
 

Quote   Quote: Originally Posted by zzz2496 View Post
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 System SpecsSystem Spec
30 May 2010   #9
zzz2496

Windows7 Ultimate 64bit
 
 

You're welcome and thanks for the rep

zzz2496
My System SpecsSystem Spec
30 May 2010   #10
zigzag3143

Win 8 Release candidate 8400
 
 

Quote   Quote: Originally Posted by ikjadoon View Post
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 System SpecsSystem Spec
Reply

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




Thread Tools





Similar help and support threads
Thread Forum
Execute Program in Batch File As Administrator (Or Other Solution)
We use a program called TFC.exe (Temp File Cleaner - addpcs.com) to wipe all sorts of temp files off a computer on a monthly basis. The older version was a standalone .exe that users used to execute from a a folder on a server. The newer version is actually installed on each user's PC. If...
General Discussion
How can I write a batch file that opens a file in a program?
I wrote this batch file which does what I want it to do so far. @echo off "C:\Users\xxxxxx\Documents\HideTaskbar\HideTaskbar.exe" "C:\Program Files (x86)\VideoLANold\VLC\vlc.exe" "C:\Users\xxxxxx\Documents\HideTaskbar\ShowTaskbar.exe" exit
General Discussion
Batch file to run 10,000 instances of a program, in groups of 32
Dear all, I have a computer with 32 (physical) cores and need to run a total of 10,000 statistical simulations. Each simulation is started with: > program.exe "scriptName.txt" where 'scriptName.txt' is 'script1.txt' , 'script2.txt', etc. The program automatically quits after completion,...
General Discussion
Batch File that grabs file names from folder to insert into batch file
Ok I'm totally at a loss on how to word this so I'm just going to write it out the best that I can... :confused: First I have a batch file that I'm writing that will convert mp4 files to mp3 files (I have a lot) for a buddies band using ffmpeg. Here's the code that I'm using: ffmpeg -i...
General Discussion
batch file open file for program in the startup folder
I have a computer that is a drone specifically for an outside LED sign. This computer is designed to never shut off and doesn't have any other program on it besides Operating System and the sign software. I need to create a batch file that I can place in the "start-up" folder that will open the...
General Discussion
Shutdown PC w/ batch file (1hour) after program(game) launched
Is it possible to do this? I want to make it so that a game shuts down the computer after "X" seconds/minutes/hours of playing the game. But i want the file to be somewhat undetected. I don't want it popping up with a message saying things like "PC will shutdown in 3 minutes" or anything like that...
Chillout Room

Our Sites

Site Links

About Us

Find 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 22:31.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App