Batch File How to Open Program and Continue
- #1
Thanks for any help.
- #2
- Aug 28, 2001
- 52,791
- 982
- 126
- #3
Does the spacing actually work for you ?
- #4
I'm not sure whether it could be integrated into Skace's batch while retaining all the functionality of the batch, but if it could be applied it would run the batch without a DOSbox appearing at all, if that's a consideration.
You can find a little more info about it at http://www.novell.com/coolsolutions/tools/14871.html
Edit: Spaces in long file names/directory paths within batch files should be ok, as long as the statement is enclosed by " "'s, as in Skace's example. At least that's true for XP, as I put together a small batch using long file names only this morning, coincidentally, and it worked ok
- #5
You can put plenty of spaces in a batch file. And yea that command works fine. Try it out, your machine should have wordpad and notepad. Just open wordpad type some crap in it and then run the batch file.Originally posted by: rh71
no spaces in batch files, correct ? Should be something like C:\Progra~1
Does the spacing actually work for you ?
Edit: Oh RT said it all. Thanks RT, btw cool app.
- #6
Thanks again!
- #7
If the shortcut to the batch works to your liking, download RunHide and throw it in your system32 folder. Then change your shortcut to call runhide with the path to the batch file in quotes: runhide "c:\bleh\mybatchfile.bat"
- #9
This is in the .bat file:
@echo off
taskkill /im firefox.exe
call "C:\Program Files\Windows Media Player\wmplayer.exe"
call "C:\Program Files\Mozilla Firefox\firefox.exe"
goto :eof
Will RT's RunHide app. hide the DOS box so it doesn't stay visible and take up any taskbar space? If so, how do I use it?
Edit:
Hmmm... I didn't notice it earlier, but after it re-launches Firefox at the end, the DOS window stays open until I close Firefox. What do I add to make the DOS window close after it re-launches Firefox?
- #10
call "C:\Program Files\Windows Media Player\wmplayer.exe"
start "C:\Program Files\Mozilla Firefox\firefox.exe"
Also, my other post has info on how to utilize runhide.
- #11
===============
@echo off
taskkill /im firefox.exe
call "C:\Program Files\Windows Media Player\wmplayer.exe"
call "C:\Program Files\Mozilla Firefox\firefox.exe"
goto :eof
===============
@echo off
taskkill /im firefox.exe
call "C:\Program Files\Windows Media Player\wmplayer.exe"
start "C:\Program Files\Mozilla Firefox\firefox.exe"
goto :eof
- #12
@echo off
taskkill /f /im firefox.exe
call "C:\Program Files\Windows Media Player\wmplayer.exe"
start /d"C:\Program Files\Mozilla Firefox" firefox.exe
goto :eof
- #13
- #14
start "bleh" "C:\Program Files\Mozilla Firefox\firefox.exe"
You don't actually see this second cmd window, but for some reason it wants a title so I titled it bleh. Try what I posted above and then try this and use whichever one works better. The problem with testing with wordpad is that Windows knows where it is and is always able to open it... I should have picked something more unique.
Edit: Ok glad that worked, I'll leave this info here incase it comes in handy. Gluck with runhide.
- #15
Error: Runhide
Error: C:\WINDOWS\system32\RunHide.exe
3052: Uninitiated variable or undefined function
STOP
On line:
WinTitlex=WinItemProcID(FoundPID,0,1)
WinBatch 32 2004F
WIL Version: 5.4fed
Additional Error Information:
Uninitialized variable or undefined function:
foundpid
- #16
Try changing "taskkill /im firefox.exe" line to "taskkill /im firefox.exe >nul"
- #19
I've tried adding the runhide parameters into the batch file itself, with mixed results.
runhide.exe taskkill /f /im firefox.exe <- Runhide deals with this fine and closes firefox
runhide.exe call "C:\Program Files\Windows Media Player\wmplayer.exe" <- Unfortunately, it's not so hot here and it just skips straight past it
runhide.exe start /d"C:\Program Files\Mozilla Firefox" firefox.exe <- Ditto for this line. It skips straight through it
For the last two lines, I even tried launching a program from a folder with a short name, in case runhide had some aversion to LFN's, but it made no difference
For some reason, it seems that runhide doesn't like start or call commands, but is fine with taskkill. Meh, sorry for getting your hopes up :/
- #20
I'm not sure what you can do about the error in runhide, don't have any experience with it.
- #21
It's not perfect, but you only see a popup dosbox for a split second before Skace's batch executes and does exactly as he intended it to do.
First create the batch file Skace put together >
@echo off
taskkill /f /im firefox.exe
call "C:\Program Files\Windows Media Player\wmplayer.exe"
start /d"C:\Program Files\Mozilla Firefox" firefox.exe
goto :eof
I stuck with the earlier suggested name of bleh.bat, cos I wasn't feeling particualrly creative, so plagiarised the earlier suggestion
Then I created another batch file in the same folder, containing the following
nircmd.exe exec hide bleh.bat
I called this hopeful.bat cos fingerscrossedthis works.bat was a tad unweildy
Now if you click on hopeful.bat you'll see a dos window popup for a fraction of a second, then firefox closes, windows media player opens, and when you close windows media player, firefox re-opens as programmed by Skace
Like I say, it's not perfect, but the dosbox that does popup is literally gone in a blink, so it may be workable for your needs
Edit: By the way, if you have the session saver plus extension installed in firefox, it gives you the option upon firefox restarting of restoring the active session at the time the batch closed it. So if you had 5 tabs and a half written reply penned on anandtech, it all pops up exactly as it was when firefox closed, which could be handy. Saved me a ton of retyping while testing
- #22
nircmd.exe exec hide WinLauncher.bat
I also saved nircmd in the same directory as the the two batch files above. I see the DOS window appear very quickly and Windows Media Player launches, but FireFox doesn't close like it's supposed to.
- #23
Thanks Skace and RT!
- Advertising
- Cookies Policies
- Privacy
- Term & Conditions
- About us
- This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
williamsonallikes66.blogspot.com
Source: https://forums.anandtech.com/threads/batch-file-to-automatically-launch-and-close-programs.1701325/
0 Response to "Batch File How to Open Program and Continue"
Post a Comment