Scripting Question

Server-side batch file copied locally and running locally.

08/15/2013 4270 views

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 -n 10 > nul


**********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


Community Chosen Answer


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.

Answered 08/15/2013 by: nheyne
Red Belt

  • 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?
    • I think so. Try using \\%COMPUTERNAME%\C$ instead of "//" and "C:".
  • \\opps i do have \\ i typoed that above, so do C$\JAVA_FIX\java-uninstall.bat?
  • "\\%COMPUTERNAME%\C:\JAVA_FIX\java-uninstall.bat" - throws a network path was not found error...
    • Should be C$ instead of C:
      • 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.
      • 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"
  • This content is currently hidden from public view.
    Reason: Removed by member request For more information, visit our FAQ's.
  • 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?
    • Can you paste the uninstall.bat?
      • 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>
  • Instead of "cscript java-uninstaller.vbs", try "cscript C:\JAVA_FIX\java-uninstaller.vbs" to define the path.
    • Thanks that worked.... cscript "C:\JAVA_FIX\java-uninstaller.vbs".. Thank you I greatly appreicate it. THANKS!!!!

All Answers

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.
Answered 08/15/2013 by: vjaneczko
9th Degree Black Belt

  • The VB portion of the script hits the registry so I am running it locally...it has unintsall instances for JAVA.
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