ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Post New Requests Here

IDEA: Run bat files transparently

(1/3) > >>

kris2lee:
I started to thinking why I do not like Windows command line option so much. Well I use it a lot but I could get more from it.

One simple idea would be running some batch using scheduler that will backup my images from one harddrive to another. This would be simple copy command  but... but it will open ugly command window that will fill my screen and got the focus.

So to get most out from command line I should be able to run it silently and log the output into file. One file per bat file execution for example. Name can be generated from bat file name adding number (or/and date) and .log extension. For example mybackup.2005-02-15.1.log.

jgpaiva:
There are two ways of doing this.
I could create a script that can run your bat file and hide the console when it runs the bat file. This is the harder way.
Or in about 3 minutes, you could learn how to use autohotkey and do it yourself ;)

As i'm a nice guy, here you go:
In ahk, the code you're looking is something like this:

--- ---Run,THENAMEOFYOURBAT.bat > FILETOSAVETHELOG.log,,Hide,
returnThis code will solve your problem, and will only display an icon on the bar for less then half a second, hardly noticeable, and no window.  :Thmbsup:

Gerome:
Hi,

In Fbsl you just have to do that :

--- ---StrPipe( "CMD.exe /K test.bat", SW_HIDE )

Into the bat file you can do such code :

--- ---@echo off
Echo Hello World! > log.txt

Your bat will be executed silently and without any console output thanks to thr SW_HIDE parameter :)

The StrPipe has more extends in Fbsl, you can redirect the piped process to any valuable Handle, that is to say it's very handy to grab a result from something that writes into stdout :)

Enjoy ;)

Rover:
I was ready to give you the quick intro to the detach command.  Then I remembered, it's an OS/2 thing.

You can run a cmd.exe window minimized with no output, but that's not quite the same.

Once again, if OS/2 ruled the world, things would be better  ..  ;)

Rover:
Aha!  How about this?

at 23:28 "%systemroot%\system32\cmd.exe /c k:\status\test.bat"

The at command schedules commands.  See cmd /? for the explaination of /c.  Be aware that each command runs in its own environment so you need to fully path the cmd.exe and the command that you want to run.  See at /? for details on scheduling the commands.

The test I ran worked without anything showing on my screen.  No focus change, etc.



Detach under OS/2 would have been easier   ;D

Navigation

[0] Message Index

[#] Next page

Go to full version