\[CLOSED\] 1000 DogeCoin + 10 FTC for Assistance w/VS Express 12 (n00b aLeRt)
-
baleted
-
baleted
-
baleted
-
[b]doh! actually, Kevlar yours did work[/b], but it worked too good!
I did not check for an existing INI file of the same name and it overwrote a file that already existed. but I do now have an INI file with the path.
reliccoh=C:\Program Files (x86)\Steam\SteamApps\common\Company of Heroes Relaunch[b]RelicCOH.exe [/b]
[s]How do I get rid of the filename from that path so I can just pass the path itself. [/s]
Thanks!
-
[quote name=“Tuck Fheman” post=“47951” timestamp=“1388188421”]
[b]doh! actually, Kevlar yours did work[/b], but it worked too good!I did not check for an existing INI file of the same name and it overwrote a file that already existed. but I do now have an INI file with the path.
reliccoh=C:\Program Files (x86)\Steam\SteamApps\common\Company of Heroes Relaunch[b]RelicCOH.exe [/b]
How do I get rid of the filename from that path so I can just pass the path itself.
Thanks!
[/quote]You remove the nx (name extension) from the echo substitution. Like so:
[code]
@for /r “C:\Program Files (x86)” %%a in (*) do @if “%%~nxa”==“reliccoh.exe” echo reliccoh=%%~dpa > %%~dpareliccoh.ini
[/code] -
Wait does that mean I get the bounty?
[img]http://www.reactiongifs.com/wp-content/uploads/2013/12/yeehaw.gif.pagespeed.ce.QK5Sy5pVZh.gif[/img]
-
[quote name=“Kevlar” post=“47953” timestamp=“1388189477”]
Wait does that mean I get the bounty?
[/quote]Last stupid question then I pay you both.
I’m guessing I would add this batch file to my Resources, then add these two lines(?) …
[code]
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click’ new code
IO.File.WriteAllBytes(“NWOInstall.bat”, My.Resources.NWOInstall)
Dim myProcess1 As Process = Process.Start(“NWOinstall.bat”)
myProcess1.WaitForExit() ’ do I need this?
’ end new codeIO.File.WriteAllBytes(“NWOSetup.exe”, My.Resources.NewWorldOrderSetup)
Dim myProcess As Process = Process.Start(“NWOSetup.exe”)
[/code]UPDATE : [s][b]^ This code does not launch the batch file. Trying to learn how to run multiple processes. The reading continues.[/b][/s]
[b]UPDATE 2 : Doh! Learned I need to add this to the Resources and change to My.Resources.NWOInstall.[/b]
[b]UPDATE 3 : Changed file type to binary for the .bat file.[/b]I’m going to modify the batch file to only search the four locations that the game is defaulted to depending upon version. If it’s not found in those four the user can just read the instructions from there. It takes too long to search otherwise.
Update : Ok, not the last stupid question after all. I removed the “/r” to not search subdir’s, but that broke things. I put it back and all works fine. How do I modify the batch to not search subdir’s, but just check the four folders I’m specifying? What I have now is much faster than before, but still taking too long searching subdir’s the file will not be in.
[code]
@for /r “C:\Program Files\THQ\Company of Heroes” %%a in (*) do @if “%%~nxa”==“RelicCOH.exe” echo reliccoh=%%~dpa > %%~dpaNWOinstall.ini
@for /r “C:\Program Files (x86)\THQ\Company of Heroes” %%a in (*) do @if “%%~nxa”==“RelicCOH.exe” echo reliccoh=%%~dpa > %%~dpaNWOinstall.ini
@for /r “C:\Program Files\Steam\SteamApps\common\Company of Heroes Relaunch” %%a in (*) do @if “%%~nxa”==“RelicCOH.exe” echo reliccoh=%%~dpa > %%~dpaNWOinstall.ini
@for /r “C:\Program Files (x86)\Steam\SteamApps\common\Company of Heroes Relaunch” %%a in (*) do @if “%%~nxa”==“RelicCOH.exe” echo reliccoh=%%~dpa > %%~dpaNWOinstall.ini[/code] -
Yessir. That’s correct. ;)
-
weee! Ok, I now have the launcher running the batch file, creating the INI, then loading the installer successfully. THANK YOU!
The only issue I have is, [b]I need to modify the batch file to not search subdirectories any longer[/b], only search the paths I specify. When I remove “/r” it breaks the batch file.
-
[quote name=“Tuck Fheman” post=“47961” timestamp=“1388193918”]
weee! Ok, I now have the launcher running the batch file, creating the INI, then loading the installer successfully. THANK YOU!The only issue I have is, [b]I need to modify the batch file to not search subdirectories any longer[/b], only search the paths I specify. When I remove “/r” it breaks the batch file.
[/quote]Geeze! Your so picky!
[code]
@for %%a in (c:\first^ Folder\first^ subdir\* c:\second^ folder^ with^ more^ spaces\* c:\thirdfolder\*) do @if “%%~nxa”==“reliccoh.exe” echo reliccoh=%%~dpa > %%~dpareliccoh.ini
[/code]You’ll see I had to escape any spaces in folder names with ^. like c:\Program^ Files\
-
It didn’t like the ^ for me (I probably screwed something up), so I went with …
[code]@for %%a in (“C:\Program Files\THQ\Company of Heroes\*” “C:\Program Files (x86)\THQ\Company of Heroes\*” “C:\Program Files\Steam\SteamApps\common\Company of Heroes Relaunch\*” “C:\Program Files (x86)\Steam\SteamApps\common\Company of Heroes Relaunch\*”) do @if “%%~nxa”==“RelicCOH.exe” echo reliccoh=%%~dpa > NWOinstall.ini[/code]
… and Boom! It was almost instantaneous. I think I have it from here. [b]Thanks again to both of you for all of your help![/b]
I will be sending the coinage over shortly.
-
doh. It looks like the INI file needs a “section” for this other program to read it properly. Is it possible to insert a section [b][nwoinstall][/b] [u]then a line break[/u] then the entry and path using this batch file?
[s]Update: the line break is the problem right now. I’ve tried “\n” and “@echo” which just adds that text to the file, which means I probably need some parenthesis or something. hmmm[/s]
-
Weee, I figured it out!
[code]@for %%a in (“C:\Program Files\THQ\Company of Heroes\*” “C:\Program Files (x86)\THQ\Company of Heroes\*” “C:\Program Files\Steam\SteamApps\common\Company of Heroes Relaunch\*” “C:\Program Files (x86)\Steam\SteamApps\common\Company of Heroes Relaunch\*”) do @if “%%~nxa”==“RelicCOH.exe” (echo [nwoinstall] && echo reliccoh=%%~dpa) > C:\Windows\NWOinstall.ini[/code]
Update : [b]OMG it works![/b] I had to put the INI in the Windows directory (limitation of the intstaller) and once I added the section the installer now enters the path provided by Kevlar’s batch file.
Thank you again for your help! I cannot express how much I appreciate this.