2 Replies - 2051 Views - Last Post: 12 March 2013 - 04:15 AM Rate Topic: -----

#1 cygorx  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 20-December 12

Quick Batch Issue: Access Denied?

Posted 10 March 2013 - 01:09 PM

Conceptually, I am creating a bash installer for a '96 game called the Neverhood. I have tested the outline for it manually, but the installer is having a bit of trouble.
In context, this is the final error I am receiving:
257 File(s) copied
The operation completed successfully.
"In reset"
A subdirectory or file C:\Program Files (x86)\DreamWorks Interactive already exi
sts.
A subdirectory or file C:\Program Files (x86)\DreamWorks Interactive\Neverhood a
lready exists.
0 File(s) copied
"In infinitum"
The syntax of the command is incorrect.

And that is it. This is the end of the output respectively to the code.
Here is the context of the code:
:opening
echo "In opening" 
echo d | xcopy __neverhood C:\__neverhood /S
reg import neverhood.reg
if not exist "C:\Program Files (x86)" goto thirtytwo
if exist "C:\Program Files (x86)" goto reset

:thirtytwo
echo "In thirtytwo"
mkdir "C:\Program Files\DreamWorks Interactive"
mkdir "C:\Program Files\DreamWorks Interactive\Neverhood"
set passagery="C:\Program Files\DreamWorks Interactive\Neverhood"
copy /Y WAVistaWin7.exe %passagery%
goto infinitum

:reset
echo "In reset"
mkdir "C:\Program Files (x86)\DreamWorks Interactive"
mkdir "C:\Program Files (x86)\DreamWorks Interactive\Neverhood"
set passagery="C:\Program Files (x86)\DreamWorks Interactive\Neverhood"
xcopy /Y /U WAVistaWin7.exe %passagery%
goto infinitum

:infinitum 
echo "In infinitum" 
C:\__neverhood\setup95.exe
rename "%passagery%\nhc.exe" "wa.exe"


I don't quite understand. Yes, the executable WAVistaWin7.exe is in the same folder. I typed it correctly.

Here is the full code:
@ECHO OFF
if exist "C:\Program Files (x86)\DreamWorks Interactive\Neverhood" goto delnevii
:delnevii
echo "In delnevii" 
"C:\Program Files (x86)\DreamWorks Interactive\Neverhood\setup95.exe"

goto begin
if exist "C:\Program Files\DreamWorks Interactive\Neverhood" goto delneviii
echo "In delneviii" 
"C:\Program Files\DreamWorks Interactive\Neverhood\setup95.exe"
goto begin
:begin
echo "In begin" 
if not exist "C:\__neverhood" goto delnev
:delnev
echo "In delnev" 
echo y | del /S /Q C:\__neverhood
goto opening
:opening
echo "In opening" 
echo d | xcopy __neverhood C:\__neverhood /S
reg import neverhood.reg
if not exist "C:\Program Files (x86)" goto thirtytwo
if exist "C:\Program Files (x86)" goto reset

:thirtytwo
echo "In thirtytwo"
mkdir "C:\Program Files\DreamWorks Interactive"
mkdir "C:\Program Files\DreamWorks Interactive\Neverhood"
set passagery="C:\Program Files\DreamWorks Interactive\Neverhood"
copy /Y WAVistaWin7.exe %passagery%
goto infinitum

:reset
echo "In reset"
mkdir "C:\Program Files (x86)\DreamWorks Interactive"
mkdir "C:\Program Files (x86)\DreamWorks Interactive\Neverhood"
set passagery="C:\Program Files (x86)\DreamWorks Interactive\Neverhood"
xcopy /Y /U WAVistaWin7.exe %passagery%
goto infinitum

:infinitum 
echo "In infinitum" 
C:\__neverhood\setup95.exe
rename "%passagery%\nhc.exe" "wa.exe"

pause>output


All help is appreciated. Thanks.

EDIT: Upon the OP, I said Bash. Sorry. I'm a tuxphile, I'm so used to saying BASH. It's actually Batch.

Is This A Good Question/Topic? 0
  • +

Replies To: Quick Batch Issue: Access Denied?

#2 #define  Icon User is offline

  • Duke of Err
  • member icon

Reputation: 1370
  • View blog
  • Posts: 4,741
  • Joined: 19-February 09

Re: Quick Batch Issue: Access Denied?

Posted 11 March 2013 - 10:03 PM

Hi, is WAVistaWin7.exe in the destination folder?
Was This Post Helpful? 0
  • +
  • -

#3 baavgai  Icon User is offline

  • Dreaming Coder
  • member icon

Reputation: 5882
  • View blog
  • Posts: 12,760
  • Joined: 16-October 07

Re: Quick Batch Issue: Access Denied?

Posted 12 March 2013 - 04:15 AM

OMG, batch files!

REM This line is pointless, you ALWAYS goto delnevii
if exist "C:\Program Files (x86)\DreamWorks Interactive\Neverhood" goto delnevii
:delnevii



Even in batch files, variables can help. You used one, use more.

Near as I can figure:
@ECHO OFF

SET TEMP_DIR=C:\__neverhood

SET ROOTDIR=C:\Program Files (x86)
if not exist "%ROOTDIR%" SET ROOTDIR=C:\Program Files

SET INSTALL_PARENT_DIR=%ROOTDIR%\DreamWorks Interactive
SET INSTALL_DIR=%INSTALL_PARENT_DIR%\Neverhood

echo Checking for %INSTALL_DIR%
if not exist "%INSTALL_DIR%" goto begin

REM Apparently, rather than killing, you want to run this?
REM I'm unsure, so ignoring
REM %INSTALL_DIR%\setup95.exe

:begin
echo "In begin" 
REM this was kindof reversed
if not exist "%TEMP_DIR%" goto opening

echo Killing %TEMP_DIR%
echo y | del /S /Q %TEMP_DIR%


:opening
echo "In opening" 
echo d | xcopy __neverhood %TEMP_DIR% /S
reg import neverhood.reg

mkdir "%INSTALL_PARENT_DIR%"
mkdir "%INSTALL_DIR%"

copy /Y WAVistaWin7.exe "%INSTALL_DIR%"


echo "In infinitum" 
%TEMP_DIR%\setup95.exe
rename "%INSTALL_DIR%\nhc.exe" "wa.exe"

pause>output



Be careful with those quotes. Quoting passagery probably threw off your setup and rename call at the end.

I tore out a few of your goto lables. The fewer you have, the less you have to follow. Don't bother going to something directly underneath, just fall through. This keeps you aware of flow. The less bouncing around, the easier things are to follow.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1