0
在Windows批处理文件中,我想要返回值,即apkVerison编号。当我在命令行或批处理文件中运行gulp getVersion时,它工作正常。我想将版本号保存到批处理文件中的变量中。如何获取Windows批处理文件中的返回值
gulpfile.js:
gulp.task('getVersion', function() {
var data = require('./package.json')
console.log('Version = ' + data.apkDependencies.apkVersion)
return data.apkDependencies.apkVersion;
});
abc.bat:
set x=gulp getVersion
echo %x%
该批处理文件不起作用。回声只是回声“一饮而尽getVersion”
对不起,我应该提到,当我运行一饮而尽,这是它的输出
gulp getVersion
[22:16:44] Using gulpfile ~\CareWheelsCorp\CareWheels\gulpfile.js
[22:16:44] Starting 'getVersion'...
Version = 9.1.13
[22:16:44] Finished 'getVersion' after 1.91 ms
正如你所看到的版本是藏在里面,我需要的是9.1.13号
对不起,当我运行一饮而尽我应该提到这是它的输出 一饮而尽getVersion [22时16分44秒]使用gulpfile〜\ CareWheelsCorp \ CareWheels \ gulpfile.js [ 22:16:44]开始'getVersion'... 版本= 9.1.13 [22:16:44] 1.91 ms后完成'getVersion' 正如你所看到的版本被隐藏在里面,我需要9.1。 13号。 –
请将此数据编辑到您的问题中,因为无法查看换行符可能会出现在哪里,也不容易从此退货中获取您希望使用的信息。 – Magoo
我编辑了我原来的问题,请查看它。所以@Magoo感谢您的答案,但它不起作用。对不起,我给了不完整的信息。 –