Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: Running a Batch File Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
A.P.B
Newbie
Newbie


Joined: January 11 2005
Location: United Kingdom
Online Status: Offline
Posts: 13
Posted: September 27 2005 at 16:47 | IP Logged Quote A.P.B

After a prolonged absence I'm back. I have a .bat file I want to run via the web. Is it possible to set up one of the menu items on the homepage to run it, if so what command do I put in the URL field. If not any suggestions has to how to do it (with coding please as I know nothing about web programming - yet!)
Allan
Back to Top View A.P.B's Profile Search for other posts by A.P.B
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: September 27 2005 at 18:09 | IP Logged Quote dhoward

Allan,

Simple enough (almost). You'll probably want to edit the pwrhome.ini file directly since the command will probably be too long for the PowerHome Explorer string (I'll fix this for the next version).

Anyways, the actual command will be:

/ph-cgi/evalformula?formula=ph_run('cmd.exe /c c:\yourpath\yourbat.bat')&nexturl=/ph-cgi/main

Just change the path and filename to match your batch file.

To manually make the change, open the pwrhome.ini file. Search for the [WebServer] section. You'll see some parameters "MENUTITLE1" to "MENUTITLE20" and "MENUURL1" to "MENUURL20". Pick the next available blank one and give an appropriate Title for MENUTITLE and then copy and paste the above URL for MENUURL. Save and reinitialize PowerHome.

If the path to your batch file contains spaces, then you'll need to wrap the path in double quotes. But, you'll have to escape them. A sample is posted below:

/ph-cgi/evalformula?formula=ph_run('cmd.exe /c %22c:\your path\yourbat.bat%22')&nexturl=/ph-cgi/main

Let me know if you have any problems.

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
A.P.B
Newbie
Newbie


Joined: January 11 2005
Location: United Kingdom
Online Status: Offline
Posts: 13
Posted: October 29 2005 at 12:45 | IP Logged Quote A.P.B

Thanks, works a treat
Back to Top View A.P.B's Profile Search for other posts by A.P.B
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum