3

I have a folder with a batch file in it. I don't want users to search for that batch file and then run it. Instead copy it as a portable software and just click the folder(actually an executable) which then runs the batch file inside the folder.

Something similar to what install4j does to jar files.

  • 2
    Try researching for 7zip and SFX. That will meet your needs – Ganesh R. Jun 13 '19 at 07:55
  • 1
    SFX as in? All I get is Sound Effects. – Tarun Maganti Jun 13 '19 at 10:32
  • See https://sevenzip.osdn.jp/chm/cmdline/switches/sfx.htm. For latest command line options, install 7 zip and open help – Ganesh R. Jun 13 '19 at 10:49
  • This is an anwer and exactly what I want. – Tarun Maganti Jun 13 '19 at 11:32
  • Yes I know. But I am too lazy to draft it correctly. Go ahead and add an answer. You can answer your own query – Ganesh R. Jun 13 '19 at 12:49
  • 1
    Came here to answer this a few hours ago and see this absolute mad man in the comments; I finally gave in and posted an answer so it could be accepted and so this will stop popping up in "unanswered". my guilt will eventually wane, or if @Ganesh wants to post one I can delete mine and be free. – mael' Jun 13 '19 at 19:26

2 Answers2

3

As @Ganesh R. stated in the comments, the thing to look into is self-extracting archive executables. There are several utilities you can use to make these (WinZip, WinRAR, etc.) but the easiest (and free-est) for most people is 7-Zip. There are a lot of great answers and walkthroughs here on superuser.

I understand you'll be using it as portable software, but keep in mind that with default settings users will have the same access to the executable as they would to a batch file - it does not require administrative privileges to run it. If you're looking to keep it safer you may also want to consider changing its permissions, making it hidden, and/or encrypting it.

mael'
  • 1,946
3

My very timely contribution to this thread, only 1 year later, is to add that Windows has kept the iexpress tool even as of 2020-09. Its an ancient GUI tool that will create a self extracting cab file. It even has builtin options to prompt user before running, and can execute commands after running.

I've used it to package many software installers and a bat file calling each in turn to run silently, or with the options I want, then checking the program is there, and cleaning up after itself.

Make sure you run iexpress with admin privileges.