Solved

cd command in script

Posted on 2009-05-11
10
243 Views
Last Modified: 2012-05-06
Using the script:

@ECHO ON
%windir%\system32\msiexec /i "Notes 8.0.2.msi" /qb /l* c:\notes8.txt
IF %ERRORLEVEL%==0 GOTO :fix ELSE EXIT /B %ERRORLEVEL%
:fix
cd ".\fix"
"Setup.exe" /v/q
IF %ERRORLEVEL%==0 GOTO :end ELSE EXIT /B %ERRORLEVEL%
PAUSE
EXIT

It installs "Notes 8.0.2.msi" fine, but then it errors at the line cd "./fix".  I've tried cd "fix" and even just cd fix.  Same error, "The system could find the path specified."  The fix\setup.exe is a service patch for Lotus Notes.
0
Comment
Question by:rbeattie27
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +4
10 Comments
 
LVL 11

Expert Comment

by:sysreq2000
ID: 24357717
Try cd \fix
0
 
LVL 2

Expert Comment

by:Baddevildog82
ID: 24357726
Try the full path to \fix.  For example, c:\temp\Fix or \system32\fix

Let us know if that will work.
0
 
LVL 2

Expert Comment

by:bootreboot
ID: 24357744
you can try a combination of lines:

cd \
cd fix
0
How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

 

Author Comment

by:rbeattie27
ID: 24357781
Sorry, I should of added this to the original post.  I'm trying to run this as a startup script and host the setup files on a server.  \\app2\netlogon\notes\install.bat is where this script is.  I think somehow it's getting messed up with it being on a network drive.

cd \fix
cd ".\fix"
cd fix

All do not work.
0
 
LVL 96

Expert Comment

by:Lee W, MVP
ID: 24357784
Post a screen shot and include a DIR before the CD ".\fix" line.
0
 
LVL 43

Accepted Solution

by:
Steve Knight earned 500 total points
ID: 24357785
Are you running this from a "UNC" path, i.e. \\server\share\xyza\fix ?

If so the current directory is probably set to c:\windows\system32 or similar rather than the dir where your other bits are.  You an test that with

dir
echo %cd%
pause

(for example).  so there is no fix dir there..

If so suggest you code in the path to the setup too, i.e. \\server\share\whatever or map a drive in th script with a net use and run it from there.

Steve

fix\setup.exe /v /q
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 24357797
Crossed posts there then.... assuming the computer account has access to these files then from a startup script you will probably need to do:

net use x: /delete
net use x: \\app2\netlogon\notes
C:
cd \fix
setup.exe
(etc)
net use X: /delete
0
 
LVL 84

Expert Comment

by:oBdA
ID: 24357817
There's no need for "cd" or mapping drives; just specify the complete path to setup.exe, starting with the script's current folder:
"%~dp0fix\setup.exe" /v /q
"%~dp0" will expand to the script's drive and path, including the trailing backslash.
0
 
LVL 2

Expert Comment

by:bootreboot
ID: 24357835
you can map a temporary drive to it

@ECHO ON
%windir%\system32\msiexec /i "Notes 8.0.2.msi" /qb /l* c:\notes8.txt
IF %ERRORLEVEL%==0 GOTO :fix ELSE EXIT /B %ERRORLEVEL%
:fix
subst L: /D
net use L: /DELETE
net use L: \\server\share\
L:
cd \share\xyza\fix
"Setup.exe" /v/q
IF %ERRORLEVEL%==0 GOTO :end ELSE EXIT /B %ERRORLEVEL%
PAUSE
net use L: /DELETE
EXIT
0
 

Author Comment

by:rbeattie27
ID: 24357894
when I inserted the DIR command, it was C:\Windows

......................WORKING SOLUTION.......................
net use n: \\app2\netlogon\notes
%windir%\system32\msiexec /i "n:\Wessanen Notes 8.0.2.msi" /qb /l* c:\notes8.txt
IF %ERRORLEVEL%==0 GOTO :fix ELSE EXIT /B %ERRORLEVEL%
:fix
"n:\Fix\Setup.exe" /v/q
IF %ERRORLEVEL%==0 GOTO :end ELSE EXIT /B %ERRORLEVEL%
PAUSE
net use n: /del
EXIT
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you receive another warning that your shared drive is almost full and you have asked your users to clean out old files again and again, here is a single command that may help. This command will place all the files that have not been used rec…
If like me you are one who spends a lot of time working and scripting with cmd.exe, sometimes it is handy to be able to quickly view a calendar for a given month and year. This script will quickly do just that!  Save the code posted below to a .bat …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question