Solved

cd command in script

Posted on 2009-05-11
10
246 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
Enroll in July's Course of the Month

July's Course of the Month is now available! Enroll to learn HTML5 and prepare for certification. It's free for Premium Members, Team Accounts, and Qualified Experts.

 

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 85

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

You may have already been in the need to update a whole folder stucture using a script. Robocopy does it well and even provides a list of non-updated files in a log (if asked to). Generally those files that were locked by a user or a process by the …
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

630 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