在%PATH%环境变量中替换文本的脚本

时间:2017-08-08 19:30:00

标签: batch-file command-line cmd

截至目前,当我们在PC上更新Java时,我们使用的某个程序用户必须使用路径(import { ParameterBase } from '../../form-data/interfaces/parameter.interface'; import { ParametersService } from './parameters.service'; import { ParameterRepositoryService } from '../shared/form-data-services/parameter-repository.service'; import { OffersPageService } from './offers-page.service'; import { FormControl, FormGroup } from '@angular/forms'; import { Component, OnInit } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { Location } from '@angular/common'; @Component({ selector: 'ofc-offers-page', templateUrl: './offers-page.component.html', styleUrls: ['./offers-page.component.css'] }) export class OffersPageComponent implements OnInit { public searchForm: FormGroup = null; public showError: boolean = false; constructor(private activatedRoute: ActivatedRoute, private router: Router, private service: OffersPageService) { } public submit(): void { let url: Array<string> = this.service.ConvertFormToUrl(this.searchForm); this.router.navigate(url); this.service.getOffers(); //change url without run subscribe method in ngOnInit } ngOnInit() { this.activatedRoute.url.subscribe(q => { //run when init component and user change url in browser Undo and Redo console.log('create form'); }); } } )中的最新Java版本号手动更新系统路径环境变量。

我的目标是尽可能通过DOS脚本自动执行此过程。我离编码器很远,但希望这个脚本搜索C:\Program Files (x86)\Java\jre1.8.0_141\bin\client,然后将其替换为"jre1.8.0_141"变量中最新更新的构建号。这样我就可以保留每个PC的环境变量,只编辑Java字符串。

我已经考虑过将条目与注册表合并,但我希望避免这种情况,因为所有系统都不相同。

到目前为止,这是我的脚本:

这是我到目前为止所做的:

%PATH%

我知道我想要完成什么,但我不知道如何将其转换为工作批处理文件,所以我道歉我没有更多的信息给你。

感谢您的帮助。

0 个答案:

没有答案