1

This is driving me crazy. I have a pretty application that does.. well, things. To start it up, some start.cmd needs to be executed. What start.cmd does is to set up some environment variables, check a few things and then start my main GUI program.

Now, everything works fine: when I click on my start.cmd everything gets launched properly. However, clicking on start.cmd causes an ugly, ugly cmd.exe to appear for an instant and then disappear. This is unacceptable!

I started looking around and I found this. It suggests to use some wscript invisible.vbsto run my start.cmd. This, however, works fine from the terminal, but I can't click on invisible.vbs directly to get what I need.

This is where I thought that I could use shortcut with the wscript invisible.vbs start.cmd command in it. However, you cannot make relative path shortcuts in Windows, which means that if I use a shortcut I will never be able to move my folder again, which is pretty bad if I need to install it around my users' computers.

So I really have no clue on how to get this apparently trivial thing done: how can I get a start.cmd batch file executed without anything showing and without having to launch anything from the terminal, and in a way that will allow me to move my folder around?

Community
  • 1
  • 1
Matteo Monti
  • 8,362
  • 19
  • 68
  • 114
  • Can you use a shortcut to `wscript.exe` with `invisible.vbs` as the argument? – MooseBoys Mar 25 '16 at 23:12
  • Yes I can but I would have to provide as working directory to wscript the folder where my program is. I would then need to know its absolute path, which would mean that it would be impossible to move my folder without breaking the shortcut. Am I right? – Matteo Monti Mar 25 '16 at 23:14

1 Answers1

0

Check the hidder.bat . You can use it to wrap a .bat or .exe file into iexpress executable file that will be ran in hidden mode.To use you need:

hidder.bat example.bat hiddenExample.exe

this line will create a hiddenExample.exe which clicked will start your bat in hidden/background mode.You can also take a look at this question

Community
  • 1
  • 1
npocmaka
  • 55,367
  • 18
  • 148
  • 187
  • This would have been exactly what I would need! However. this doesn't seem to work. I made an example `test.bat` script with `ECHO mytest > test.txt` in it. If I click it, a `test.txt` file appears with `mytest` in it. Now I run `hidder.bat test.bat test.exe`. Some `test.exe` is generated. If I click on it, however, nothing happens at all. I am using Windows 10... could this be a problem? – Matteo Monti Mar 26 '16 at 15:37
  • @MatteoMonti - iexpress executes its post-extraction commands in directories like `%temp%\IXPXXX.TMP` (but not in the current directory) and when it's finished the folder is deleted. You can't pass arguments to the created exe. So in your bat you'll need to hardcode the path to the file you want to output to.E.g `echo test>%temp%\mytestFile.txt` – npocmaka Mar 26 '16 at 16:08
  • Which brings me back to the previous problem, that I would never be able to move my folder! Too bad! – Matteo Monti Mar 26 '16 at 16:35