locked
Install.bat works in Windows XP but not in Windows 7 RRS feed

  • Question

  • I am using a batch file something like below to install my application's Service in Windows 7 platform and i am not able to do so. The same works just fine in Windows XP. Any thoughts will be highly appreciated.

    @ECHO OFF 
     
    REM
    The following directory is for .NET 2.0 
    set DOTNETFX2=%SystemRoot%\Microsoft.NET\Framework\v2.0.50727 
    set PATH=%PATH%;%DOTNETFX2% 
     
    echo
    Installing MyService... 
    echo
    --------------------------------------------------- 
    InstallUtil /i MyService.exe 
    echo
    --------------------------------------------------- 
    echo
    Done. 

    The Error message is like below:

     

    c:\Windows\system32>REM The following directory is for .NET 2.0

    c:\Windows\system32>set DOTNETFX2=C:\Windows\Microsoft.NET\Framework\v2.0.50727


    c:\Windows\system32>set PATH=c:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C"\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\Microsoft.NET\Framework\v2.0.50727


    c:\Windows\system32>echo Installing MyService...
    Installing MyService...

    c:\Windows\system32>echo ---------------------------------------------------

    c:\Windows\system32>InstallUtil /i MyService.exe

    Microsoft (R) .NET Framework Installation utility Version 2.0.50727.4927
    Copyright (c) Microsoft Corporation. All rights reserved.

    Exception occurred while initializing the installation:
    System.IO.FileNotFoundException:Could not load file or assemble 'file:///C:\Windows\system32\MyService.exe' or one of its dependencies. They system cannot find the file specified...

    c:\Windows\system32>echo ---------------------------------------------------

    c:\Windows\system32>echo Done.
    Done.

     

     

    Wednesday, November 24, 2010 7:44 AM

All replies

  • Seems like accessing "MyService.exe" file from your Windows\System32 Directory is denied.

     

    Try to run the bat with administrative privilege.


    Ryan Kim
    Wednesday, November 24, 2010 9:11 AM
  • Hi,

    Thanks for the prompt reply...but my userid has administrative privileges. first had issue with running the install.bat and i changed the user's privilege to administrator.

    :(

    Wednesday, November 24, 2010 9:17 AM
  • Even though the User has Administrative privilege, if the UAC (User Account Control) is on, you must stop it or open the cmd.exe with administrator privileged, and run the install.bat

     

    You can add a proper manifest to your TService application which will then 

    pop up the elevation prompt on install/uninstall. (Refer https://forums.embarcadero.com/message.jspa?messageID=184236)


    Ryan Kim
    Wednesday, November 24, 2010 9:29 AM
  • http://windows.microsoft.com/en-US/windows7/How-do-I-run-an-application-once-with-a-full-administrator-access-token
    "A programmer is just a tool which converts caffeine into code" CLIP- Stellvertreter http://www.winvistaside.de/
    Wednesday, November 24, 2010 1:30 PM
  • Hi, Thanks for your reply. This was all done already...the cmd prompt was set to run as administrator and UAC settings done as per mentioned. But still we get the same error as i mentioned above...Please do help as i am really very sure that there should be some firm solution for this from Microsoft... :(
    Thursday, November 25, 2010 2:11 AM
  • System.IO.FileNotFoundException which means some files are not found.

    Which 3rd party DLL do you use?


    "A programmer is just a tool which converts caffeine into code" CLIP- Stellvertreter http://www.winvistaside.de/
    Thursday, November 25, 2010 2:21 PM
  • it was typed by me as i had to take it from command prompt and so the mistake. I still have this problem but finally made my client to work with Windows XP and solved partially.
    Monday, December 6, 2010 8:25 AM