/build/static/layout/Breadcrumb_cap_w.png

Server-side batch file copied locally and running locally.

I have a script that looks something like this, but recieve network location unavailable whenever I run it, and it is probably a SYNTAX issue, but I can't seem to figure it out.

 

::Copies JAVA remove .bat file and VB script to local HDD.

START /WAIT xcopy \\serverlocation\folder\folder2\JAVA_FIX\*.* "C:\JAVA_FIX\" /S /I /H /Q /Y

::Pause to ensure copy completion.

ping 127.0.0.1 -n 10 > nul

"//%COMPUTERNAME%\C:\JAVA_FIX\java-uninstall.bat"

**********Where I have the "//%COMPUTERNAME%\" is where the issue seems to be coming up, and I can't seem to figure it out :( Please any help would be greatly appreciated.


0 Comments   [ + ] Show comments

Answers (2)

Posted by: nheyne 11 years ago
Red Belt
2

Is your script running as the SYSTEM user?  If so, it won't have the ability to grab anything from your \\serverlocation share because it is not a network user.  Try running it as the logged on user.


Comments:
  • It is on an Windows XP environment and I am listing on a portion of the entire script, but basically most of the script grabs stuff from the server location and then this one JAVA remove script has to be run locally there for I told it to copy that script to the local station and then it is suppose to excute it locally which is why i was trying to use the computername variable. Does that make sense? - 56kGhost 11 years ago
    • I think so. Try using \\%COMPUTERNAME%\C$ instead of "//" and "C:". - nheyne 11 years ago
  • \\opps i do have \\ i typoed that above, so do C$\JAVA_FIX\java-uninstall.bat? - 56kGhost 11 years ago
  • "\\%COMPUTERNAME%\C:\JAVA_FIX\java-uninstall.bat" - throws a network path was not found error... - 56kGhost 11 years ago
    • Should be C$ instead of C: - dugullett 11 years ago
      • After changing it to "\\%COMPUTERNAME%\C$\JAVA_FIX\java-uninstall.bat" ...the CMD window will close out when it reaches that portion of the batch file. - 56kGhost 11 years ago
      • Sorry.... you should also have a call in there. Also make sure you are sharing that drive.

        call "\\%COMPUTERNAME%\C$\JAVA_FIX\java-uninstall.bat" - dugullett 11 years ago
  • Thanks, it now calls that .bat which is then to call a .VBS file that is located in that JAVA_FIX folder, however when it tries to call taht .vbs file it is looking for it in the C:\WINDOWS\java-uninstaller.vbs.........for some reason, if you run the script manually by copying down the .VBS and .bat file that you helped fix above it will work, any ideas why it now thinks that .VBS is in the windows directory? - 56kGhost 11 years ago
    • Can you paste the uninstall.bat? - dugullett 11 years ago
      • REM <start>
        @echo off
        if not exist c:\temp\. mkdir c:\temp
        REM Export the Uninstall registry keys
        start /wait "" REGEDIT /E c:\temp\registry.tmp HKEY_LOCAL_MACHINE\SOFTWARE\microsoft\windows\currentversion\uninstall
        REM Filter only the {} keys that Java might be in
        type c:\temp\registry.tmp | find /i "{" | find /i "}]" > c:\temp\uninstall.tmp
        type c:\temp\registry.tmp | find /i "JRE 1" >> c:\temp\uninstall.tmp

        REM Run the Vbscript that uses this file to find Java Sun entries to uninstall
        cscript "java-uninstaller.vbs"
        REM <end> - 56kGhost 11 years ago
  • Instead of "cscript java-uninstaller.vbs", try "cscript C:\JAVA_FIX\java-uninstaller.vbs" to define the path. - nheyne 11 years ago
    • Thanks that worked.... cscript "C:\JAVA_FIX\java-uninstaller.vbs".. Thank you I greatly appreicate it. THANKS!!!! - 56kGhost 11 years ago
      • Glad to help. - nheyne 11 years ago
Posted by: vjaneczko 11 years ago
9th Degree Black Belt
1
Instead of copying the script to the local drive, why not just run it? I don't see anything that requires it to exist on the local C: drive to work.

Comments:
  • The VB portion of the script hits the registry so I am running it locally...it has unintsall instances for JAVA. - 56kGhost 11 years ago
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ