| Forum Home | ||||
| Press F1 | ||||
| Thread ID: 74318 | 2006-11-18 02:02:00 | Batch file help please | johcar (6283) | Press F1 |
| Post ID | Timestamp | Content | User | ||
| 500227 | 2006-11-18 02:02:00 | I need to edit a batch file so it will work on my laptop, rather than the server at work. The file's purpose is to open an application, using a specified licence filename and a specified username/password and then run a script stored in the same database that the application accesses. (I will obscure app names, user/password etc to protect the innocent) The batch file consists of: "C:\Program Files\APPLICATION\APPLICATION.exe" username\password /l C:\Program Files\APPLICATION\LICENCEFILENAME /c "[SQLServer]SERVERNAME\DATABASENAME" /s "SCRIPTNAME" I know it works on the server at work, because I run it both manually and via a scheduled task while I am testing the application. However I have tried in vain to run the same script on my laptop (XP Pro, with SQL Server 2005 and the target database/application installed) - with changes to reflect the local environment of course. If I amend the script and run ["C:\Program Files\APPLICATION\APPLICATION.exe" username\password /l], the application opens fine - so there is something wrong in the syntax involving either the licence file or the database path (I think)... The script was not originally written by me, so I am not sure of the significance of the switches embedded in the file (the "/l" and the "/c")... I am sure we must have some clever batch-file people :nerd: out there who can point out the obvious thing I am missing... :) |
johcar (6283) | ||
| 500228 | 2006-11-18 02:19:00 | "[SQLServer]" is an environment variable. The batch script is interpreted, so any such variables are evaluated before they are used. I'd guess that it is getting as far as starting the application, but falling over because it can't find "SERVERNAME/DATABASE" . The environments are different. :( You could try adding a line like SET SQLServer=C:\wherever\it\isbefore the line which starts the application. That might be all wrong for systax in XP; doubtless the XPerts will correct me. :D But I suspect that's the sort of thing you need to do. |
Graham L (2) | ||
| 500229 | 2006-11-18 05:35:00 | This is fairly obvious and I expect you've checked already, but can you connect to the database on SQL server from your laptop at all? Most database servers accept only connections from the local network for security reasons, although I've never used MS SQL Server so I have no idea what the defaults are. Exposing your database server to the outside world is not generally a good idea. It is far better to expose data services using a web service as this provides an extra layer of security and more fine-grained control. Every service you expose increases security risks - each one should be carefully planned. |
TGoddard (7263) | ||
| 500230 | 2006-11-18 07:57:00 | "[SQLServer]" is an environment variable. The batch script is interpreted, so any such variables are evaluated before they are used. I'd guess that it is getting as far as starting the application, but falling over because it can't find "SERVERNAME/DATABASE" . The environments are different. :( You could try adding a line like SET SQLServer=C:\wherever\it\isbefore the line which starts the application. That might be all wrong for systax in XP; doubtless the XPerts will correct me. :D But I suspect that's the sort of thing you need to do.Thanks Graham - not sure exactly how to set a variable in a batch file, but I'll try some permutations .. .. |
johcar (6283) | ||
| 500231 | 2006-11-18 08:04:00 | This is fairly obvious and I expect you've checked already, but can you connect to the database on SQL server from your laptop at all? Most database servers accept only connections from the local network for security reasons, although I've never used MS SQL Server so I have no idea what the defaults are.Yes - I can connect to the database - via the application whose front-end it is and also via SQL Server. Pretty sure the issue is in the syntax. Exposing your database server to the outside world is not generally a good idea. It is far better to expose data services using a web service as this provides an extra layer of security and more fine-grained control. Every service you expose increases security risks - each one should be carefully planned.The setup on the laptop is not a Production setup - I am testing ('cos that's what I do) some new functionality and wanted to try to replicate the test environment that I use at work on my own laptop, so I can test at home - or after hours - since I have no real life to speak of!! :D The Production setup is not web-based - users access the application via the GUI front-end on a secure internal network or via Citrix on the same network. |
johcar (6283) | ||
| 1 | |||||