none
Trying to run a batch file on a UNC path RRS feed

  • Question

  • I'm running a pretty simple script that loops through names on machines, and runs batch files.  Here's my code:

            Dim RetVal1 As String
            Dim RetVal2 As String
            RetVal1 = Shell("\\" & Cell & "\c$\Java\bin\service\StopServerService.bat", 1)
            RetVal2 = Shell("\\" & Cell & "\c$\Java\bin\service\StartServerService.bat", 1)

    Each 'Cell' contains a machine name.

    I keep getting a message about UNC paths not being supported.  I could swear this that was working last week!!


    Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.

    • Moved by Marvin_Guo Friday, March 28, 2014 5:54 AM
    Thursday, March 27, 2014 2:08 AM

Answers

  • Hi,

    I think this case is more related to a script language ,I will help you move to Scripting forums.

    Thanks for your understanding.

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by ryguy72 Friday, March 28, 2014 12:03 PM
    Friday, March 28, 2014 5:53 AM
  • I keep getting a message about UNC paths not being supported.  I could swear this that was working last week!!

    I would simplify matters by running this command from a Console (cmd.exe):

    \\ComputerName\c$\Java\bin\service\StopServerService.bat

    • Does it work?
    • What does StopServerService.bat contain?
    • What operating system do the two machines run?
    • Is UAC active on the remote machine?

    After solving the problem at the console level you should get further advice from a VBA forum.

    • Marked as answer by ryguy72 Friday, March 28, 2014 12:03 PM
    Friday, March 28, 2014 11:38 AM

All replies

  • Hi,

    I think this case is more related to a script language ,I will help you move to Scripting forums.

    Thanks for your understanding.

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by ryguy72 Friday, March 28, 2014 12:03 PM
    Friday, March 28, 2014 5:53 AM
  • I keep getting a message about UNC paths not being supported.  I could swear this that was working last week!!

    I would simplify matters by running this command from a Console (cmd.exe):

    \\ComputerName\c$\Java\bin\service\StopServerService.bat

    • Does it work?
    • What does StopServerService.bat contain?
    • What operating system do the two machines run?
    • Is UAC active on the remote machine?

    After solving the problem at the console level you should get further advice from a VBA forum.

    • Marked as answer by ryguy72 Friday, March 28, 2014 12:03 PM
    Friday, March 28, 2014 11:38 AM
  • I got this working.  I actually created 2 blank batch files.  The first time I run through the loop, I write the language I need to the batch file, save it, and close it.  Then, I run the batch file, and finally I clears the contents of the fail.  On the next pass through the loop I write new language, save it, close it, run it, and clear it.  I loop through this process many times, each time turning off Windows services and turning on Windows services.  It works great.

    Thanks everyone.


    Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.

    Friday, March 28, 2014 12:03 PM
  • I do not see why you don't just start and stop the services directly.  Why do you think you need a batch file.  Excel can run external commands. 

    Shell "net stop " & strServiceName


    ¯\_(ツ)_/¯

    Friday, March 28, 2014 1:59 PM