Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I found a lot of stuff online about creating invisible bat files. I came closest to wrapping my mind around this one:

Run a completly hidden batch file

However, in my application, I can't figure out how to get this to work. Here is my current setup that works (with annoying cmd windows popping up all over the place).

I am using the app uTorrent to run a bat file whenever a torrent finishes. Within the app, there is a field to "Run this app when a torrent finishes". I have entered:

C:\scripts\torrentscript.bat "%D" "%N" "%L" "%K" "%F" >> C:\scripts\torrentlog.txt

Can someone hold my hand through setting this up so that the bat runs invisibly? I cant figure out how to pass all the parameters through properly. A huge bonus would be if I could keep the log file working properly as well for debugging.

Thank you so much!!

ETA bat file:

@echo off
title Duplicating a Freshly Downloaded Movie or Show
rem Parameter usage: fromdir torrent-name label kind [filename]
rem corresponds to uTorrents flags: %D %N %L %K %F 
echo *********************************************
echo Run on %date% at %time%

set fromdir=%1
set name=%2
set label=%3
set kind=%4
set filename=%5
set savepartition=J:
set moviedir=%savepartition%\"Movies [NOSYNC]"
set showdir=%savepartition%\"TV [NOSYNC]"

rem Only process PTP or BTN Auto torrents
if %label%=="PTP" goto movie
if %label%=="BTN Auto" goto show

GOTO :EOF

:movie
echo ***Movie**********
set todir=%moviedir%
set type="New Movie"
if %kind%=="single" goto single
goto multi

:show
echo ***Show**********
set todir=%showdir%
set type="New TV Show"
if %kind%=="single" goto single
goto multi

:single
echo Single
echo %fromdir%%filename% %todir% /I
xcopy %fromdir%%filename% %todir% /I
goto growler

:multi
echo Multi
echo %fromdir% %todir%\%name% /I
xcopy %fromdir% %todir%\%name% /I
goto growler

:growler
call "C:\Program Files (x86)\Growl for Windows\growlnotify.exe" /a:"uTorrent" /n:"Finished" /t:%type% %name%
echo Processing Complete on %date% at %time%
share|improve this question
    
when you say invisibly, do you mean so the cmd prompt does not show up at all or so the string you entered into the Run this app when torrent finishes does not echo out into a cmd prompt window? –  Richie086 Dec 6 '13 at 22:12
    
and is there any possibility you could post the contents of your batch file? –  Richie086 Dec 6 '13 at 22:12
    
Thanks so much for your reply! I'm wanting the black box to NOT pop up. I added the bat to the OP. –  user279891 Dec 6 '13 at 22:41
1  
@Richie086 I used the tool Wyatt mentions below and converted the bat to an exe. I then changed my command within uTorrent to: C:\scripts\torrentscript.exe "%D" "%N" "%L" "%K" "%F" The target file was not copied, but the growler subroutine did go off. I am really at a loss. How could it work as a bat and then fail as an exe? –  user279891 Dec 7 '13 at 2:36

2 Answers 2

You may also just run hidecon.exe from your batch. This won't however hide it from process list.

share|improve this answer
    
Thank you! We're getting warmer. This almost did the trick. I would prefer, though, that the cmd box not even appear for an instant. If I call that exe from the bat, the box still appears briefly. (Better than having it up for the whole time the file is being copied, though. Thanks!) Anyone have an idea that will let it run with absolutely no visual distractions? –  user279891 Dec 9 '13 at 3:08
    
@user279891 I see, well there is also hideexec.exe which is used to hide cmd.exe window from outside instead of from within so the window should be hidden from the beginning. –  Vlastimil Ovčáčík Dec 10 '13 at 17:46
    
This is very cool! –  Wyatt8740 Dec 14 '13 at 23:17

There are two ways to interpret this question. I will address both the ways I can interpret it.


  1. If you just don't want any text printed to the black box, but still want the black box to appear, add @echo off to the top of your batch file.

  2. If you don't want the black box to appear at all (run in background), I have been very successful with Bat to Exe from f2ko.

It is not, as far as I know, possible to run a plain batch file without a black box, but by converting it to a windows executable with this program, you can check a checkbox labeled 'run in background'. This is how I have always done it. You can even add icons!

If you just used piping to create your log file ( >, |, <, etc), then this should allow you to log. Otherwise, it should do anything a normal batch script would, just without a black box.

share|improve this answer
    
I agree 100% with wyatt's answer - it really depends on what you mean by invisible. –  Richie086 Dec 6 '13 at 22:32
    
Thank you :) I have done this with lots of scripts that run tweaks or disable devices or whatever else. –  Wyatt8740 Dec 6 '13 at 22:34
    
Thanks for your help guys. I'll try converting to an exe and report back. –  user279891 Dec 7 '13 at 2:06
    
@Wyatt8740 I used the tool and converted the bat to an exe. I then changed my command within uTorrent to: C:\scripts\torrentscript.exe "%D" "%N" "%L" "%K" "%F" The target file was not copied, but the growler subroutine did go off. I am really at a loss. How could it work as a bat and then fail as an exe? –  user279891 Dec 7 '13 at 2:35
    
Could you post the contents of your batch file? It would make debugging far easier. –  Wyatt8740 Dec 7 '13 at 19:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.