views:

51

answers:

2

Question:

We have a situation at work where we would like to run the following scripts:

xcopy /s c:\STANDAARD_DETAILS_V2\PDF\8.1A.pdf C:\STANDAARD_DETAILS_V2\TEMPDUMP


del /s "C:\STANDAARD_DETAILS_V2\TEMPDUMP\*.pdf"

However the I.T. manager is dead against batch scripts is there a html or javascrip code/ equivelent for doing this.

Note the IT manager is not against the function of the script, its simply a no batch files policy.

+2  A: 

No. You cannot run these commands using javascript or html, that would be a function they're absolutely not considered for. Simplest would be a batch script... If your IT Manager just doesn't like batch scripts, there are several ways:

  • Install some script language interpreter on the machine and write a script in another language (e.G. Python, Perl, Ruby, ..)
  • Write several lines that call exec() in C or C++ or whatever else language you can compile to a .exe file, and give him the .exe file
  • Write a batch script and change the file extension from .bat to .cmd
joni
+1 for the last suggestion. :D
deceze
same policy on .exe (he's got a problem now hes hierd an Autocad admin guy who likes stepping out of the normal boundrys)
Bob
@Bob Seriously, what *are* you allowed to do there? :)
deceze
the .cmd others are going to requer me to learn entier languages and programs for simple things like this (havent the time ....today, lol)
Bob
write Auto lisp they employed me to keep Autocad in shipshape only that was too boring.
Bob
tryed the .cmd what im trying to do is have it run from a linked file within Acrobat, all it keeps returning is that Acrobat wont allow it. see system administrator.
Bob
@Bob honestly, what do you want? You cannot use .bat files, but you don't want to use another language? Then just forget it... The only thing that comes to my mind now is just creating a windows .lnk file (Right click->create shortcut/link) and give ` xcopy /s c:\STANDAARD_DETAILS_V2\PDF\8.1A.pdf C:\STANDAARD_DETAILS_V2\TEMPDUMP;del /s "C:\STANDAARD_DETAILS_V2\TEMPDUMP\*.pdf ` as "Run command", but I don't know if windows is intelligent enough to run several commands when they're seperated by ";"
joni
A: 

You could always do it through PHP (that is, if he turns a blind eye to using web scripts), but that's basically abstracting it another level for no reason. Or make JavaScript call a CGI binary which does it. For reference the PHP code would basically be


<?php
exec("xcopy /s c:\STANDAARD_DETAILS_V2\PDF\8.1A.pdf C:\STANDAARD_DETAILS_V2\TEMPDUMP");
exec("del /s \"C:\STANDAARD_DETAILS_V2\TEMPDUMP\*.pdf\"");
?>

Hope this helps.

xyzjace
Then he must install XAMPP or at least just php, and XAMPP as far as I know contains many exes and .bats :P
joni
I suppose so yeah. I'm assuming that they've got some form of web server running though.
xyzjace
php,never used it remember im self taught, perhaps you could sugest a website outling its usage. also hens the request of a html or javascript equivlent as i also thought of ussing them as a "brige" to launch the .bat, only then you run itno that blasted activ x warning and a stuipid autoshat brouwser remains open (now requiers too many clicks for simple minded end user)..
Bob
checked the active x state and this can not be fiddeld with either as hes put a bar on this too, yikes what a control freak!
Bob
Like joni suggested, you'll probably need to have XAMPP installed and running or IIS on your local machine with PHP support enabled. Sounds like PHP isn't the answer, sorry.
xyzjace