[NWjs] Run *.bat or cmd from path

Get help using Construct 2

Post » Wed Mar 07, 2018 7:09 pm

Just opening this up as I am trying to do the same thing. I want to run a .bat file so that I can download updated files for my app.
I can write a .bat file that does it job and downloads to the installed NWJS directory. But the moment I am asking C2 to run the bat file (Like above) it does not function as expected.

I have to put START at the beginning of my .bat file but this then for some reason stops it using the --ouput-document to save to the installed folder.

Anyone know any work arounds?
B
42
S
11
G
1
Posts: 221
Reputation: 4,613

Post » Fri Mar 09, 2018 7:26 pm

BUMP to see if any one can help?

Currently my .bat file is:
"wget.exe" "https://drive.google.com/uc?export=download&id=1GfARdi3WQaCnxolZxL5Gnxamr" --output-document "%~dp0\packagetest.nw"

This works when double clicking the file in explorer.
When adding a command in C2 to run this:
"""" & NWjs.AppFolder & """" & "update.bat" & """" & """"

It doesnt action it.

@ashley is there something different by using NWJS to run a .bat file that is stopping this?

Update:

I have got it working but only when the project is placed in a location with no spaces in the directory "C:\test" for example.
My C2 command is currently:
"start " & NWjs.AppFolder & "update.bat"

I just have not been able to get the double quotation marks in the right place to get this working for all locations?

Currently I have tried:

"start " & """" & NWjs.AppFolder & """" & "update.bat"

"start " & """" & NWjs.AppFolder & "update.bat" & """"

"""" & "start " & NWjs.AppFolder & "update.bat" & """"
B
42
S
11
G
1
Posts: 221
Reputation: 4,613

Post » Mon Mar 12, 2018 11:58 am

Try setting that expression to a text object and make sure that it actually matches what works from a command prompt.
Scirra Founder
B
414
S
245
G
92
Posts: 25,203
Reputation: 200,347

Previous

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 8 guests