Lets get this going.
So I was messing around with Diablo II and wanted to play in window mode. Pretty easy todo just add -w after " in the desktop shortcut, but no. Lets make a useless batch scrip for that. Oh yeah!
Start up Notepad or other favourite text editor.
The most easiest thing to do is, just to use this code here:
@echo off
START "D2" "Diablo II.exe" -w && ECHO Execute D2: OK
exit
This will start diablo 2 in window mode. So thats pretty simple.
But what if we want to have some fun with it.
Lets just start by putting in a title, it will show on the top of the cmd window.
@echo off
TITLE Diablo 2 Window Mode
Now it has a title. Next we can check to see if the Diablo II.exe is were it is.
IF EXIST "Diablo II.exe"
This will check and see if the exe file is there, we need the "" if there is spaces. But it goes no were, so we need to add some more to the code. Lets try.
IF EXIST "Diablo II.exe" (START "D2" "Diablo II.exe" -w) ELSE (Exit)
Looks better, so If Diablo II.exe exist, Start Diablo II.exe, else exit the program.
It works kinda like the first code above, but with the feature to see if the exe file exist. The fist code will just exit and thats that.
Lets add a little more to the code, we want to know if the file does not exist and if starting D2 is a go.
IF EXIST "Diablo II.exe" (START "D2" "Diablo II.exe" -w && ECHO Execute D2: OK) ELSE (Exit)
The only thing we will change is after the START command we add && and an ECHO to display text, the && means it will run at the same time as START. Letting you know it runs.
What about if the file does not exist ? Easy, we do kinda the same thing. instead of ELSE (Exit) we do
ELSE (Echo Execute D2: Failed && Pause && Exit)
So the full line will look like.
IF EXIST "Diablo II.exe" (START "D2" "Diablo II.exe" -w && ECHO Execute D2: OK) ELSE (ECHO Execute D2: Failed && PAUSE && EXIT)
As a last thing we do a PAUSE. So the full code will look like
@echo off
TITLE Diablo 2 Window Mode
IF EXIST "Diablo II.exe" (START "D2" "Diablo II.exe" -w && ECHO Execute D2: OK) ELSE (ECHO Execute D2: Failed && PAUSE && EXIT)
PAUSE