How do I edit a file with a batch program without having the complete path? - batch-file

I am trying to write a batch program to rewrite the realmlist.wtf for World of Warcraft and put in the correct realms. I ran into the problem after finishing it that some people had different directories than me(Ex:I had C:\Program Files (x86)\World of Warcraft\Data\enUS while others had F:\WoW\3.5.5a\data\enUS) I want to find a way to replace this no matter the path before data\enUS. Help?

You should find the install path by looking in the Windows Registry. As for how to do that from a batch file, see here: http://www.robvanderwoude.com/ntregistry.php . Everybody who has WoW installed should have a registry value in a well-known location that points to the installation's base directory.

Related

Problem with WPF Setup Program Installation Path

I have a Program Setup project in my solution that should install my program to the default location:
[ProgramFilesFolder][Manufacturer][ProductName]
However, this is not working and the installer is dumping all of the project files into my C: drive during installation without creating any folders at all. Even the installer says the files will be installed in "C:\Program Files (x86)\blah\blah", but they aren't. I double-checked I have values set for manufacturer and product name that don't include any special characters besides space.
I followed this tutorial step by step to get where I am:
https://learn.microsoft.com/en-us/cpp/ide/walkthrough-deploying-your-program-cpp?view=vs-2019
Any ideas on what could be causing my installation files to be placed in the C: drive?
I will say, my project runs correctly when running from the C drive, so the installation is technically working, it's just failing to create the program files folders and place the installation files in the correct location.
Thanks.
It seems the issue has to do with permissions on the computer. The files install to the correct directory when the installer is ran from the downloads folder.
I still find it odd that the installer dumps files into the C root drive instead of aborting the task, but at least I know now you can avoid this issue by running installer from the downloads folder.

MSDeploy Auto Generated deploy.cmd path issue?

I've been working on trying to figure out why our auto-generated deploy.cmdscripts will not work when installed to C:\Program Files (x86)\OurProgram. I finally narrowed down the issue to the closing parenthesis in (x86) as the script would terminate with "Files was unexpected at this time". One possible solution was to manually create another batch file to set _DeploySetParametersFile to a Windows path ( C:\Program^ Files^ (x86^)\OurProgram\Program.Parameters.xml). This isn't a valid solution for me, so I dug into the auto generated file and found the issue to be 2 variables:
RootPath
_DeploySetParametersFile
Both of which were referenced using %'s(i.e. %RootPath%), however as soon as they were changed to !'s(i.e. !RootPath!), no 2nd script was needed and I can run the cmd script from Program Files (x86) just fine. The issue of course with this is, the deploy.cmd file is auto-generated on each build, thus I have to change it for each build I do. My question is this: Is there a way to edit the template Visual Studio uses to generate the deploy.cmd file? If so, where? It seems so ridiculous that Microsoft would have this be an issue in their web deployment.

Nunit TestResult.xml is not created during Jenkins build

To run tests in Jenkins I use the next batch command:
"C:\Program Files (x86)\NUnit 2.6.4\bin\nunit-console.exe" /result:TestResult.xml "C:\Users\Denis\Documents\Visual Studio 2013\Projects\MyProject\App.nunit"
Here how it looks in Jenkis:
The problem is: it doesn't generate TestResult.xml file!
When I run the same command as a .bat file from my desctop it creates the TestResult.xml file.
Any ideas what is wrong with Jenkins?
P.S. I searched for created file in all possible folders and even via "search"
I came up with thought that the file is generated and removed then or something like this.
The thing is that I don't see this file indeed but Jenkins generated report based on this file! So I think maybe after generating report the file was removed automatically.
I had faced the same issue and I found the test results xml file under my user directory in Win 7.
Note : I think it's some problem with nunit that it doesn't export the file to the location of which we provide the path.

Run .bat as a Windows Service

I'm here again with another case that is getting me out my mind.
So, this is happening, I'm trying to run an executable java class(.jar) as a Windows Service, and all my attempts failed so far. To make it a little easier, I turned my jar into a batch file, wich only executes the jar in background, here is the code:
start "" javaw -jar C:\LocalService.jar
The batch works fine. However I have tried to install this batch as a service by using the next line in cmd:
sc create "LocalService" binPath= "C:\LocalService.bat"
The Service installs correctly, but as soon as I try to start it, it pops up an error (The code error is 1053, says something about the service did not start correctly)
Also, I have try with a software called NSSM (non-sucking service manager) It installs fine too, but the service does not start either.
Do you guys know what am I missing?
By the way, I'm doing all this on Windows 7 Professional.
Thanks!
thanks for your comments
Both tools didnt work for me, sadly. However I was able to do it with a software called Java Service Wrapper. This is not a free software, so I needed to buy a license to get it to work.
The steps were simple:
1.-Create a folder with the name of the service, then inside add 4 folders: lib,bin,logs,conf
2.-On the lib folder you have to copy your jar and also the wrapper.jar and wrapper.dll (these last two are in the zip you download from the website)
3.-Copy 4 files to the bin folder: InstallApp-NT.bat.in, App.bat.in, UnintstallApp-NT.bat.in and wrapper.exe (this last one is the one that defines your license, if you can get a file wrapper.exe from somebody else who had paid a license it will work fine. These file also came in the zip from the website) Remove the .in from the batch files
4.-The most tricky step is this: You have to copy from the wrapper's folder called conf a file called wrapper.conf.in Remove the .in extension and edit it with a tex editor. The most important lines you have to edit are:
wrapper.java.command=C:\Program Files (x86)\Java\jre7\bin\java //Specify JRE Path. Will work with eviroment variable
wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperJarApp //Choosing this class means your are using a .jar file to execute when the service starts
wrapper.java.classpath.1=C:\LocalService\lib\wrapper.jar //This one is constant.
wrapper.java.classpath.2=C:\LocalService\lib\LocalService.jar //This is the path to your executable jar
wrapper.java.library.path.1=C:\LocalService\lib //Path to your own lib folder (the you created at the begining)
wrapper.app.parameter.1=C:\LocalService\lib\LocalService.jar // again the path to your jar
Then just execute the InstallApp-NT.bat and start the service and your are done
It worked to me with absolute paths, however according to documentation it will work fine with relative path too.
This is how I solved my problem and I hope someone with the same issue will find this helpful
See you next time!

Cannot run program "make": The system cannot find the file specified?

This is the first time that this error has come up. I am using Cygwin with Eclipse 3.5 and my Path variable is set to: %CommonProgramFiles%\Microsoft Shared\Windows Live;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\Apache Ant\bin;C:\Program Files\SVN\bin;C:\Program Files\Java\jdk1.6.0_18\bin;C:\Users\Mohit\Developer\AndroidSDK\tools;C:\Program Files\QuickTime\QTSystem\;C:\cygwin\bin Notice that C:\cygwin\bin is in my Path. And make.exe is is my Cygwin bin. So I think the problem is not with my system, but maybe my project. But I can't find anything wrong with it. Any suggestions?
Use Process Explorer to take a look at the PATH environment variable inside Eclipse's process. It's possible that it's changing its PATH internally -- if that's the case, you'll need to figure out how to configure Eclipse so that its PATH is set up correctly.
If you're finding that C:\cygwin\bin isn't in Eclipse's PATH, and you recently added that to your PATH, you need to close and restart Eclipse for that change to take affect.
If you still can't figure it out, try using Process Monitor with a filter for Eclipse.exe to get a long, detailed listing of everything it's trying to do. Look for the call to CreateProcess() that's failing and see if you can learn anything more.
I had same problem and I solved that copy make.exe file in path that ecilipse given.
from link below
http://www.mediafire.com/download/e9j9g4zun2t68jn/make.exe
hope helps
I go around this issue by installing MinGW and use its GCC compiler.
Environment - OS: Windows 10, Eclipse: Oxygen

Resources