Correct InstallUtil Path To File Syntax? - syntax

I'm trying to install a Windows Service using a batch file, let's call it "installservice.bat". Inside the file I have the following commands:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe -i ".\MyService.exe"
pause
When I excute the batch file (running as administrator on Vista) I get this:
Exception occurred while initializing the installation:
System.IO.FileNotFoundException: Could not load file or assembly 'file:///C:\Win
dows\system32\MyService.exe' or one of its dependencies. The system cannot f
ind the file specified..
The actual service is located at C:\Services\MyService.exe. What should the ".\MyService.exe" part be for it to function properly?

Just in case someone else comes here for this error... when you run InstallUtil.exe, if the path to your service contains spaces, surround it with quotes. Yes this is obvious, but the error it gives you if you don't is not.
wrong...
C:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe C:\Users\joeblow\Documents\Visual Studio 2010\Projects\WindowsService1\WindowsService1\bin\Debug\WindowsService1.exe
right...
C:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe "C:\Users\joeblow\Documents\Visual Studio 2010\Projects\WindowsService1\WindowsService1\bin\Debug\WindowsService1.exe"

Why not just feed InstallUtil the full path?

copy the bat file MyService.exe folder and execute, you wont get any error.

Related

Unable to locate jenkins.xml file within executable directory or any parents

I've installed jenkins on windows, and I wanted to use jenkins command to start and stop the program from anywhere in the system.
It turns out that after configuring jenkins and creating the environment variable I get the error below everytime I execute "jenkins start" from outside C:\Program Files (x86)\Jenkins.
Is there any configuration missing?
ERROR
System.IO.FileNotFoundException: Unable to locate jenkins.xml file within executable directory or any parents
at winsw.ServiceDescriptor..ctor()
at winsw.WrapperService.Run(String[] _args, ServiceDescriptor descriptor)
at winsw.WrapperService.Main(String[] args)
SYSTEM ENVIRONMENT VARIABLES
JENKINS_HOME:
C:\Program Files (x86)\jenkins
Path:
%JENKINS_HOME%
You need to run your jenkins install jenkins.xml at the place where is your jenkins.xml
1 rename winsw.exe to jenkins.exe
2 cd c:/...where is your jenkins.exe
3 run jenkins.exe install jenkins.xml (both files must be in the same directory)
In Windows 10, the path of the configuration file (config.xml) is:
C:\ProgramData\Jenkins.jenkins
The Folder ProgramData is hidden, so go to the address bar and type or use the CLI.
Solution: Save your jenkins-agent file as xml format. not just jenkins-agent.xml
we can use notepad++ to save the xml type. similarly remove .exe at end of jenkins-agent.exe
Hope its useful.... cheers !!

how to run a program from cmd when trying to execute from path throws errors

I am trying to write a C# program that executes a .exe application. In the cmd prompt if I type the full directory (C:\Users\User\Program\program.exe) I get thrown an error:
Error message: Can't open config file data/program.cfg.
Error reading data/program.cfg
However if I Cd to C:\Users\User\Program\ I can start the program by typing program.exe or program, or alternatively by just double-clicking the application file. I also tried adding the directory to my PATH but it throws the same error.
What could be causing this issue?
The issue is that the program has a bug because of which it looks for its config file (data\program.cfg) relative to the current directory, rather than relative to the directory where it is installed.
You can work around this in your .NET program by using System.Diagnostics.Process.Start with a ProcessStartInfo parameter, where you will set WorkingDirectory to the directory C:\Users\User\Program.

Application is not launching from command line full path, because a depend file is not loading

When i tried to open the abc.exe by double clicking, it is working fine but when i tried to open from command prompt with full path it throw an error due to a dependent file.
Command is - "C:\Program Files\work\project\abc.exe"
and dependent file "abc.txt" also placed at "C:\Program Files\work\project"
when i do the cd C:\Program Files\work\project and then try to open the abc.exe, it is working fine.
At all other systems it is working fine buy at my pc it is giving error.
I checked the registry seeting and path but did not see and difference.
Please suggest me how to solve this issue.

.exe in artoolkit bin folder not executing and says applpication failed to start correctly

After building the artoolkit.sln in the visual studio and when examples like simpletest1 is made to run the error pops out saying 'Failed to start the application ' ..
Help regarding is really appreciated
Thanks in advance
Ankith
When you install the ARToolkit (i.e extracting the ZIP distribution), All the files are extracted only with Read and Write permissions, but not with execute permissions.
Hence change the permission to Read,Write & Execute (i.e. 777, 755, etc) and then try to run the file. It might run.

Windows Bat file run from Autosys - Failed to load the sqljdbc_auth.dll

I have a question and wondering if you guys could help.. Here are the details -
Program Flow ->
Autosys Job -> Windows .bat job on network path-> Internally calls java program along with few other components
When the .bat runs through Autosys job, it gives below warning and does partial processing and exits out without any failure
(i guess the internal code might not have good error handling..but sadly I do not have access to view/modify the same). However, when I logon to that
windows box and run the .bat file from cmd prompt, it works like a charm and throws no error.
Warning in Logs - "WARNING: Failed to load the sqljdbc_auth.dll"
Things I tried-
I tried creating a wrapper bat file in windows C drive (not the netwrok path where the actual .bat is in) and placed sqljdbc_auth.dll in that custom folder.
Job went to SU , after partial processing.
Appreciate your help.
Many Thanks,
Raj
I'd suspect there is a path error. Try echo %path% just before calling your batch, even simply run
echo %path%>alogfile
call yourbatch
and if the displayed path doesn't include a directory in which your .dll resides, add it into the path before calling yourbatch.
It may very well be that your logon includes the required directory as part of your user-defined path and the username under which the job runs does not include the directory.
Or, you could try moving the dll into somewhere like system32 which should be common to everyone.
(Windows should use the standard path-scanning algorithm to locate any required dll that isn't invoked from a full pathname)

Resources