Jump to content
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble

MSFN is made available via donations, subscriptions and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, register and become a site sponsor/subscriber and ads will be disabled automatically. 


  • Content count

  • Donations

  • Joined

  • Last visited

Community Reputation

0 Neutral

About Hexploder

Profile Information

  • OS
    Windows 7 x64
  • Country
  1. Hi everybody... 8 years late, sorry for the resurrection I hope not to bother anybody, but I came across this page today looking for a solution for this and I didnt test the last response answer cuz I didnt saw it in time but I found a way that... at the end may help for some other stuff and I found this solution quite elegant, structured, and pretty much bullet proof. So first of all, my solution goes around the problem, instead of using SFX shortcut language, you make your own Batch Script. So to examplify, in my case I had a Batch Program that work over the hosts file, finding if there is a certain config and if its commented or not, then you can add that config, comment or make the config available, so anyways, the point was to solve a work trouble and I wanted to make a self-extract specific to C:\... lets say its a folder named "Folder1" inside the %HOMEDRIVE% (usually C:\), then the batch is batch.cmd and I have an batch.ico. So then I made another batch, lets name it install.cmd inside that .cmd I have to: 1 - Put a shortcut of the batch.cmd in user desktop 2 - Erase the install.cmd So if you search how to make a shortcut with CMD you will find that its a bit much for something so simple so... instead of that, you just make a shortcut of batch.cmd inside Folder1, configure the .ico in properties and thats it you have the shortcut made, and it will be self-extracted alongside everything else. So, inside install.cmd you writte: @ECHO OFF REM Go to main folder cd %HOMEDRIVE%\Folder1 REM Copy Batch.lnk to user profile desktop copy "batch.lnk" %USERPROFILE%\Desktop\ REM Delete Folder1's batch.lnk del "batch.lnk" REM Delete itself del shortcut.cmd So, note that I use "copy" instead of move for no particular reason in this case, but if you copy it then you can copy it again to somewhere else if you want, but you can definitelly enchange copy + del for move. Also, have in mind that I'm using the global variable %USERPROFILE% since this SFX should work for any of my co-workers and work just fine. And at the end it self-destruct. Done you have your Folder1 with everything you need, lets make the SFX in advanced SFX options you have to go to Installation instead of advanced, there in the first text box is where you have to put the path of the install.cmd in this case C:\Folder1\install.cmd The beauty of this is that in that install.cmd you can add anything else that you want, its not only to make a shortcut, make a shortcut with this is just an example of something that could be so much more, for example, you could put a .dll file, move the .dll file to %windir%\system32 then use regsvr32 dllname.dll to register that .dll if you need it, or add a string in the registry, or execute the batch.cmd after installation, maybe you have a batch.cmd with a batch.conf file with variables that then in batch.cmd you SET with a FOR /F, so the install.cmd could check things like, ip, user name, pc name, windows architecture, etc and then change variables in batch.conf. There is no end on what you could do with this method, for me is a really good work around to solve a simple problem and at the same time the solution opens up itself to a wide range of possibilities. Best Regards. And sorry for my bad English