1
我想開發一個批處理文件,該文件運行很多類型爲「phonegap local plugin add」的命令,以便在我想共享我的應用程序時自動執行Phonegap插件安裝過程。如何製作Phonegap插件安裝程序批處理文件?
我發現在Linux上開發了以下解決方案:
#!/usr/bin/env node
//this hook installs all your plugins
// add your plugins to this list--either
// the identifier, the filesystem location
// or the URL
var pluginlist = [
"org.apache.cordova.device",
"org.apache.cordova.device-motion",
"org.apache.cordova.device-orientation",
"org.apache.cordova.geolocation",
"https://github.com/chrisekelley/AppPreferences/"
];
// no need to configure below
var fs = require('fs');
var path = require('path');
var sys = require('sys')
var exec = require('child_process').exec;
function puts(error, stdout, stderr) {
sys.puts(stdout)
}
pluginlist.forEach(function(plug) {
exec("cordova plugin add " + plug, puts);
});
我想開發一個Windows批處理文件的代碼。有人能告訴我我該怎麼做?
你人治...! – Rahnzo
@axl只有在cordova是一個批處理文件的情況下,您纔會嘗試編輯,並且沒有聲明cordova是批處理文件。 '.exe'或'.com'文件不需要'call'命令。 – foxidrive