首页 \ 问答 \ 如何将文件内容读入批处理文件中的变量?(How to read file contents into a variable in a batch file?)

如何将文件内容读入批处理文件中的变量?(How to read file contents into a variable in a batch file?)

该批处理文件将从TEST发布到LIVE。 我想在此文件中添加一个检查约束,以确保在特定文件夹中有一个附带的发行文档。

"C:\Program Files\Windows Resource Kits\Tools\robocopy.exe" "\\testserver\testapp$"        
"\\liveserver\liveapp$" *.* /E /XA:H /PURGE /XO /XD ".svn" /NDL /NC /NS /NP
del "\\liveserver\liveapp$\web.config"
ren "\\liveserver\liveapp$\web.live.config" web.config

所以我有几个关于如何实现这个的问题?

  1. \\testserver\testapp$文件夹中有一个version.txt文件,该文件的唯一内容是构建号(例如,45 - 用于构建45)如何读取version.txt文件的内容在批处理文件中变成一个变量?

  2. 如何使用第1部分的变量代替{build},检查文件\\fileserver\myapp\releasedocs\ {build}.doc存在?


This batch file releases a build from TEST to LIVE. I want to add a check constraint in this file that ensures there is an accomanying release document in a specific folder.

"C:\Program Files\Windows Resource Kits\Tools\robocopy.exe" "\\testserver\testapp$"        
"\\liveserver\liveapp$" *.* /E /XA:H /PURGE /XO /XD ".svn" /NDL /NC /NS /NP
del "\\liveserver\liveapp$\web.config"
ren "\\liveserver\liveapp$\web.live.config" web.config

So I have a couple of questions about how to achieve this...

  1. There is a version.txt file in the \\testserver\testapp$ folder, and the only contents of this file is the build number (for example, 45 - for build 45) How do I read the contents of the version.txt file into a variable in the batch file?

  2. How do I check if a file ,\\fileserver\myapp\releasedocs\ {build}.doc, exists using the variable from part 1 in place of {build}?


原文:https://stackoverflow.com/questions/3068929
更新时间:2022-10-01 14:10

最满意答案

我禁用此项目的即时运行,问题解决。

也许这是Android Studio 2.0预览中即时运行功能的错误。

Instant Run是Android Studio 2.0中引入的一项新功能。

ps:如果你没有找到即时运行,它在:

Android Studio --> Preferences --> Build, execution, deploy --> Instant run.

或者您可以在首选项选项卡中搜索它。


I discovered that the dex file was getting larger than the buffer, even though it contained less than 64k methods. Then I enabled ProGuard and it helped a lot reducing the dex file size.

THe application dex-method-counts helps a lot to debug your dex file, by checking not only the number of methods, but to what package they belong

相关问答

更多
  • 试试这个 Class _class = null; try { _class = Class.forName("com.android.server.pm.PackageManagerService"); Log.i("Test", "Class found"); } catch (ClassNotFoundException e) { e.printStackTrace(); } Method method = nu ...
  • 我遇到了同样的问题。 该解决方案首先将AAR文件部署到本地maven(我使用https://github.com/dcendents/android-maven-gradle-plugin插件)。 然后我参考了https://stackoverflow.com/a/23045791/2563009中描述的本地maven。 最终我用一个传递选项声明了依赖关系,如下所示: dependencies { compile('com.myapp.awesomelib:awesomelib:0.0.1@aar') ...
  • 我禁用此项目的即时运行,问题解决。 也许这是Android Studio 2.0预览中即时运行功能的错误。 Instant Run是Android Studio 2.0中引入的一项新功能。 ps:如果你没有找到即时运行,它在: Android Studio --> Preferences --> Build, execution, deploy --> Instant run. 或者您可以在首选项选项卡中搜索它。 I discovered that the dex file was getting lar ...
  • 您可能错过了一个jar,尝试通过执行您之前执行的操作将此jar添加到类路径中: 右键单击>属性> Java构建路径>库>添加罐 下载此JAR: http : //central.maven.org/maven2/commons-io/commons-io/2.4/commons-io-2.4.jar You are maybe missing a jar, try adding this jar to the classpath by doing just what you did before: righ ...
  • 经过长时间的研究,我认为我知道这是什么问题,但我不知道如何解决它。 症状:编译大jar和/或几个jar,导致eclipse崩溃,当它没有崩溃错误消息:写输出麻烦:操作码== null,转换为Dalvik格式失败,错误2。 原因:DX无法处理超过16bit字符串中包含的内容,因此,无法包含(至少不是平均时间)超过此字符串的长度。 结果:无法将Android的复杂应用程序编程为一个APK。 对Android开发人员的建议(我不太确定你是如何构建它的):你可以使用arraylist这些字符串,每个字符串依次将自己 ...
  • 解决了 我直接删除了jar lib,从工作区lib项目中删除,清除我的项目,从“dexedLibs”手动删除dexed lib这个jar(166字节)并再次导入lib项目并包含在我的项目中。 这又是幸福。 Solved I deleted directly jar lib, removed from workspace lib project,clear my project, manually delete dexed lib from "dexedLibs" this jar (166 bytes) a ...
  • 您需要确保在手机上启用了调试,并且已安装相应的USB驱动程序。 然后它应该出现在Android Studio的运行配置中。 有关更多信息,请查看以下指南: http : //developer.android.com/tools/device.html You need to make sure that debug is enabled on your phone, and that the appropriate usb driver is installed. Then it should appea ...
  • 此消息是因为您的应用程序安装了旧版本的应用程序,该版本的dex大小与您正尝试安装的当前版本不同,因此您应该按OK继续操作! 但我相信我之前没有安装这个apk。 检查您是否使用与您的设备上安装的其他应用程序相同的软件包名称[最可能由您]! This message is because there is an old version of your app installed on the device that has a dex size different from the current one yo ...
  • 路标罐位于Bintray JCenter ,因此您可以将它们添加到您的Gradle脚本中: dependencies { compile(group: 'oauth.signpost', name: 'signpost-core', version: '1.2.1.2') compile(group: 'oauth.signpost', name: 'signpost-commonshttp4', version: '1.2.1.2') } Signpost jars are in Bin ...
  • 好吧,我找到了很多这个问题的解决方案,但没有一个能解决这个问题。 事实证明我已将目标SDK从22更改为23,这就是导致此问题的原因。 当我把它改回22时,它有效! 我不知道为什么,我正在认真考虑将最小的SDK更改为11(我已付出很多努力与API 10兼容,但我认为仍然使用API 10的用户很少并且努力绝对不值得)。 Well, I found a lot of solutions to this problem but none has worked in my case. It turned out th ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)