Im having problems compiling a very simple .js file to .exe
"
var WindowStyle_Hidden = 0
var objShell = WScript.CreateObject("WScript.Shell")
var result = objShell.Run("cmd.exe /c checker.bat", WindowStyle_Hidden)
"
this is my code, (i didnt create this code, its on the internet. it works great when you double click on it, but wont compile) basically i want to use this simple java script to start a hidden batch file when the computer starts (running the .exe im trying to compile from the registry, which for some retarted reason wont run it as a .js)
the error i get from JSC (what im using to try and compile) says:
myfilename.js (3,16) : error JS1135: Variable 'WScript' has not been declared.
does anyone know either how to declare that, or compile it or even better help me with a better way to run a hidden batch from the registry when the computer starts. i want it hidden because its annoying to look at every time the computer starts.
i hope that i have provided enough enformation
Re: Im having problems compiling a very simple .js file to .exe
javascript != java ;) The code posted is actually javascript, which isn't compiled but ran (typically) by web browsers. Not sure if you need java or javascript, but if you are interested in java suggest the following: The Java™ Tutorials
Re: Im having problems compiling a very simple .js file to .exe
For the most part i understand that. what I would like is to have the registry run a .js file in order to open a hidden batch file to perform tasks in the background. the reason i was investigating compiling a .js file is because it seems that the script will not execute when run from the registry HKEYLOCALSOFt~MICR~WIND~CURR~RUN. <-(hope thats obvious enough) the .js works perfectly fine and does exactly what i want when i double click on it. Really what Im trying to do is find a way launch a hidden batch window from the run key.
Re: Im having problems compiling a very simple .js file to .exe
Cool, hope there's another useful info.