如何自动运行交互式shell的命令?

时间:2018-05-02 08:23:08

标签: windows shell

我正在寻找rc file。我想执行

chcp 65001 > nul
cd %TEMP%

每次启动新的交互式shell时。系统信息:

Clink v0.4.8 [git:d565ad] Copyright (c) 2012-2016 Martin Ridgers
http://mridgers.github.io/clink

Microsoft Windows [Version 10.0.16299.125]

myuser@MYHOST C:\Users\myuser
$ choco info conemu | rg -i ^^conemu
ConEmu 18.4.29.0 [Approved] Downloads cached for licensed users

myuser@MYHOST C:\Users\myuser
$ █

1 个答案:

答案 0 :(得分:0)

安装Clink时,它会将自己添加到shell的自动运行注册表项中。它的方式是registering the .bat file used to run it。这样,每次启动新shell时,都会运行此文件。因此,所有您需要做的就是打开export class SelectionBoxYear extends React.Component { constructor(props) { super(props); this.state = { value: 'oneYear' }; this.handleChange = this.handleChange.bind(this); } handleChange(e) { this.setState({ value: e.target.value },()=>{ let { value } = this.state; this.props.callbackFromParent(value); this.props.onHandleChange(value, this.props.dataFromParent) }); } render() { return( <div> <label> <p>Select the year of the investment:</p> <select value={this.state.value} onChange={this.handleChange}> <option value="oneYear">One year ago</option> <option value="twoYear">Two years ago</option> </select> </label> </div> ) } } 并将命令添加到文件末尾的启动部分,然后生成clink:

clink.bat

(请注意,我使用:launch chcp 65001 > nul cd %TEMP% start /b "Clink" cmd.exe /s /k ""%~dpnx0" inject %clink_profile_arg%" exit /b 0 ,因此会保留您的新代码页