im trying to make a Batch Script under Windows . to stablish the Configurations of the game called "Ragnarok International".
And please dont tell "Simple Use Installer" because the idea of make this , its 1 learn batch , and two included in a personal autocontent version of "Ragnarok International" , that package , its for "Linux / Windows / Mac OS X" users . and i think its better included a Simple Script in Batch for Windows , to configure and make the Shortcuts.
Well im trying with the follow Code :
@echo off
color A
title Ragnarok International
set DIR="%CD%"
set PWD=%CD%\wine\data\drive_c\software
REG QUERY "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v Desktop
FOR /F "usebackq tokens=3 skip=4" %%i in (`REG QUERY "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v Desktop`) DO SET DESKTOPDIR=%%i
FOR /F "usebackq delims=" %%i in (`ECHO %DESKTOPDIR%`) DO SET DESKTOPDIR=%%i
set IRODIR="%DESKTOPDIR%\Ragnarok International"
echo ===========Configuring Software=========
echo.
if exist "%IRODIR%" (
if not exist "%IRODIR%\Ragnarok Classic.lnk" goto make_icr
if not exist "%IRODIR%\Classic Setup.lnk" goto make_ics
if not exist "%IRODIR%\Setup.lnk" goto make_setup
if not exist "%IRODIR%\Ragnarok Replay.lnk" goto make_replay
if not exist "%IRODIR%\Ragnarok.lnk" goto make_ragnarok
)
cd "%DESKTOPDIR%
echo "Make the Directory"
If NOT exist "%IRODIR%" md "%IRODIR%" goto shortcuts
:shortcuts
echo.
echo "Make the Shorcuts"
echo.
:make_icr
echo "Ragnarok Classic"
set SCRIPT="%TEMP%\%RANDOM%-%RANDOM%-%RANDOM%-%RANDOM%.vbs"
echo Set oWS = WScript.CreateObject("WScript.Shell") >> %SCRIPT%
echo sLinkFile = "%IRODIR%\Ragnarok Classic.lnk" >> %SCRIPT%
echo Set oLink = oWS.CreateShortcut(sLinkFile) >> %SCRIPT%
echo oLink.TargetPath = "%PWD%\ClassicRO.exe" >> %SCRIPT%
echo oLink.WorkingDirectory = "%PWD%" >> %SCRIPT%
echo oLink.Save >> %SCRIPT%
cscript /nologo %SCRIPT%
del %SCRIPT%
echo.
:make_ics
echo "Classic Setup"
set SCRIPT="%TEMP%\%RANDOM%-%RANDOM%-%RANDOM%-%RANDOM%.vbs"
echo Set oWS = WScript.CreateObject("WScript.Shell") >> %SCRIPT%
echo sLinkFile = %IRODIR%\Classic Setup.lnk >> %SCRIPT%
echo Set oLink = oWS.CreateShortcut(sLinkFile) >> %SCRIPT%
echo oLink.TargetPath = "%PWD%"\Setup_Classic.exe >> %SCRIPT%
echo oLink.WorkingDirectory = "%PWD%" >> %SCRIPT%
echo oLink.Save >> %SCRIPT%
cscript /nologo %SCRIPT%
del %SCRIPT%
echo.
:make_setup
echo "Setup"
set SCRIPT="%TEMP%\%RANDOM%-%RANDOM%-%RANDOM%-%RANDOM%.vbs"
echo Set oWS = WScript.CreateObject("WScript.Shell") >> %SCRIPT%
echo sLinkFile = %IRODIR%\Setup.lnk >> %SCRIPT%
echo Set oLink = oWS.CreateShortcut(sLinkFile) >> %SCRIPT%
echo oLink.TargetPath = "%PWD%"\Setup.exe >> %SCRIPT%
echo oLink.WorkingDirectory = "%PWD%" >> %SCRIPT%
echo oLink.Save >> %SCRIPT%
cscript /nologo %SCRIPT%
del %SCRIPT%
echo.
:make_replay
echo "Ragnarok Replay"
set SCRIPT="%TEMP%\%RANDOM%-%RANDOM%-%RANDOM%-%RANDOM%.vbs"
echo Set oWS = WScript.CreateObject("WScript.Shell") >> %SCRIPT%
echo sLinkFile = %IRODIR%\Ragnarok Replay.lnk >> %SCRIPT%
echo Set oLink = oWS.CreateShortcut(sLinkFile) >> %SCRIPT%
echo oLink.TargetPath = "%PWD%"\Ragexe.exe 1rag1 Replay >> %SCRIPT%
echo oLink.WorkingDirectory = "%PWD%" >> %SCRIPT%
echo oLink.Save >> %SCRIPT%
cscript /nologo %SCRIPT%
del %SCRIPT%
:make_ragnarok
echo "Ragnarok"
set SCRIPT="%TEMP%\%RANDOM%-%RANDOM%-%RANDOM%-%RANDOM%.vbs"
echo Set oWS = WScript.CreateObject("WScript.Shell") >> %SCRIPT%
echo sLinkFile = %IRODIR%\Ragnarok.lnk >> %SCRIPT%
echo Set oLink = oWS.CreateShortcut(sLinkFile) >> %SCRIPT%
echo oLink.TargetPath = "%PWD%"\Ragnarok.exe >> %SCRIPT%
echo oLink.WorkingDirectory = "%PWD%" >> %SCRIPT%
echo oLink.Save >> %SCRIPT%
cscript /nologo %SCRIPT%
del %SCRIPT%
echo.
goto iro
echo ===========Configuring Software=========
pause
:iro
echo.
start /b %windir%\explorer.exe "%IRODIR%"
well , The Errors are in the first "if not exist" show me "and" its not reconized command or function (that its trying read the Path C:\Documents and Settings)
And the another fail , its when the script try to make the shorcuts : C:\DOCUME~1\ADMINI~1\CONFIG~1\Temp\755-14902-9577-25159.vbs(2, 15) Microsoft VBS cript compilation error: Expected end of statement
"Setup" C:\DOCUME~1\ADMINI~1\CONFIG~1\Temp\31294-32230-10280-4385.vbs(2, 1) Microsoft VB Script runtime error: Object required: 'Setup'
Well this are not working , someone can help me to fix the script . i dont know how to make it in Batch , for me its more ease Bash XD.
I have no clue from VBS, sorry.
Additional, this is not correct:
you can have only one command per line here: