Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Executing a batchfile with cold fusion

Status
Not open for further replies.

ksutphin

Programmer
Jan 27, 2005
11
0
0
I had the following code running on an old ColdFusion 4.0 server. The code calls a batch file that goes out to our domain, loops through all of our terminal servers, and resets certain application sessions for the user that is running the cfm page.
<script language="JavaScript">
document.location.href = "Call_ResetGPTerm_Sessions.bat"
</script>
The server crashed on us the other day and I had to move it over to a MX7 server. Now it will not run. I've tried using <cfexecute> but still nothing. With <cfexecute> I don't get any error messages, but nothing happens. I couldn't use <cfexecute> before, which is why I was using JavaScript. Execute would be better, because the batch file simply calls another 'exe' file that actually does all the work.
My feeling is that the MX7 server is configured correctly to run executables or even bat files. I have change the log in for the Application service to from the local system account to a userid that would definetly have permissions to all the executables, so I'm not sure what else to try.

Kenneth
 
Why use the webserver to run a batch file? that can be done with at the OS level.

If you don't ask the right questions, you don't get the right answers. A question asked in the right way often points to its own answer. Asking questions is the ABC of diagnosis. Only the inquiring mind solves problems.

-Quote by Edward Hodnett
 
Well that's is a good question. We're using Microsoft Great Plains and users will get 'locked' up in the system. Instead of our help desk getting 4 or 5 calls a day to go into Great Plains to delete the users from the user activity table, I wrote a web page for the users to use to delete their own ID based upon there windows logon ID. It's just a simple SQL script that does a delete on the table. That worked well for a while, but then we set up about 5 terminal servers that we loaded Great Plains on and now the users do a remote session into the termianl servers to run the great plains executable. The don't remote into the desktop, they just run great plains throug a remote window. Once we did that the web page would delete the user id from great plains, but the 'exe' was still running as an open terminal server session. I used a scripting language called 'Winbatch' to run some command line utilities that give me information about what exe is being run by a particular user id on any give server. From that information I build some batch files on the fly to end the process id of great plains on what ever server the user is logged into, because I don't have a cross reference of which user is using which server. This worked great as well until I hit this problem of calling the bat file from the web page. I'm really only using this bat to call the winbatch exe file. If I can call it directly from the web page that would be my preference, but I could never get that to work. I agree with you that I could make the users use a combination of the web page and the exe, but you know how users are when you 'add a step' to something they used to do in 1 step. The whole purpose of the page to start with was to make there lives easier, and I hate to go backwards.

Kenneth

 
This may not be any help because i don't know exactly how "great plains" works along with your setup but you could make a dsn for each user activity table if it's a db that can be accessed via ip such as sql server or mysql (if the tables are not on the webserver with CF). make the page with a delete query for each dsn.

however, my thinking is you used to use a javascript to run the bat file so i'm not sure its a cf fault. If you changed much of the server you could have removed permissions for webadmin to run files or any number of things.

This is a pretty rough question, I hope one of us can help with it.

If you don't ask the right questions, you don't get the right answers. A question asked in the right way often points to its own answer. Asking questions is the ABC of diagnosis. Only the inquiring mind solves problems.

-Quote by Edward Hodnett
 
I used Javascript because cfexecute wasn't available in CF 4.0 that I know of. Can some one tell me if the syntax on this code is correct?
<cfexecute name="\\server1\share\MyExecutable.exe"</cfexecute>

I think it is and if that's true then it leads me to think it's a server setting, because all of our users have permission to the directory.

Thanks,
Kenneth
 
try using the drive letter your server is mapped to. If it isn't mapped try to map the CF server to the server with the bat file.

e:\MyExecutable.exe

replace "e" with the actual drive letter.

If you don't ask the right questions, you don't get the right answers. A question asked in the right way often points to its own answer. Asking questions is the ABC of diagnosis. Only the inquiring mind solves problems.

-Quote by Edward Hodnett
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top