Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/160.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ .bat脚本以删除尾部空白_C++_C_Windows_Batch File_Scripting - Fatal编程技术网

C++ .bat脚本以删除尾部空白

C++ .bat脚本以删除尾部空白,c++,c,windows,batch-file,scripting,C++,C,Windows,Batch File,Scripting,我对通过windows制作脚本相当陌生。也许我需要的不是剧本。我在linux中使用带有csv文件的sed做了一些类似的事情,但我想创建一个.bat脚本文件(或类似的文件),它将接收一个c头文件并删除所有尾部空白 编辑理由:(我的VPN RePo不允许拖尾空白,当使用C++ UI表单时,每次添加新对象时,添加尾随空白,例如按钮) 编辑: 它发生在如下所示的注释之后 "// // outputStringsTab // " 示例snippit:

我对通过windows制作脚本相当陌生。也许我需要的不是剧本。我在linux中使用带有csv文件的sed做了一些类似的事情,但我想创建一个.bat脚本文件(或类似的文件),它将接收一个c头文件并删除所有尾部空白


<>编辑理由:(我的VPN RePo不允许拖尾空白,当使用C++ UI表单时,每次添加新对象时,添加尾随空白,例如按钮) 编辑: 它发生在如下所示的注释之后

        "// 
         // outputStringsTab
         // "
示例snippit:

#pragma region Windows Form Designer generated code
      /// <summary>
      /// Required method for Designer support - do not modify
      /// the contents of this method with the code editor.
      /// </summary>
      void InitializeComponent(void)
      {
         this->tabCollection = (gcnew System::Windows::Forms::TabControl());
         this->outputStringsTab = (gcnew System::Windows::Forms::TabPage());
         this->justificationComboBox = (gcnew System::Windows::Forms::ComboBox());
         this->stringSizeDropBox = (gcnew System::Windows::Forms::ComboBox());
         this->stringFontLabel = (gcnew System::Windows::Forms::Label());
         this->label7 = (gcnew System::Windows::Forms::Label());
         this->stringSizeLabel = (gcnew System::Windows::Forms::Label());
         this->stringBackgroundLabel = (gcnew System::Windows::Forms::Label());
         this->fontCheckListBox = (gcnew System::Windows::Forms::CheckedListBox());
         this->greenRadio = (gcnew System::Windows::Forms::RadioButton());
         this->blueRadio = (gcnew System::Windows::Forms::RadioButton());
         this->whiteRadio = (gcnew System::Windows::Forms::RadioButton());
         this->blackRadio = (gcnew System::Windows::Forms::RadioButton());
         this->label4 = (gcnew System::Windows::Forms::Label());
         this->label3 = (gcnew System::Windows::Forms::Label());
         this->label2 = (gcnew System::Windows::Forms::Label());
         this->label1 = (gcnew System::Windows::Forms::Label());
         this->shapePage = (gcnew System::Windows::Forms::TabPage());
         this->circleAngleGroupBox = (gcnew System::Windows::Forms::GroupBox());
         this->circleAngleLabel = (gcnew System::Windows::Forms::Label());
         this->circleAngleStartTextBox = (gcnew System::Windows::Forms::TextBox());
         this->circleAngleEndTextBox = (gcnew System::Windows::Forms::TextBox());
         this->circleAngleButton = (gcnew System::Windows::Forms::Button());
         this->startAngleLabel = (gcnew System::Windows::Forms::Label());
         this->degreesLabel2 = (gcnew System::Windows::Forms::Label());
         this->endAngleLabel = (gcnew System::Windows::Forms::Label());
         this->degreesLabel1 = (gcnew System::Windows::Forms::Label());
         this->lineSuppresionGroupBox = (gcnew System::Windows::Forms::GroupBox());
         this->squareLineLabel = (gcnew System::Windows::Forms::Label());
         this->noneSuppressRadio = (gcnew System::Windows::Forms::RadioButton());
         this->topSuppressRadio = (gcnew System::Windows::Forms::RadioButton());
         this->bottomSuppressRadio = (gcnew System::Windows::Forms::RadioButton());
         this->leftSuppressRadio = (gcnew System::Windows::Forms::RadioButton());
         this->rightSuppressRadio = (gcnew System::Windows::Forms::RadioButton());
         this->sizeGroupBox = (gcnew System::Windows::Forms::GroupBox());
         this->circleRadioButton = (gcnew System::Windows::Forms::RadioButton());
         this->shapesHeightWidthLabel = (gcnew System::Windows::Forms::Label());
         this->squareRadioButton = (gcnew System::Windows::Forms::RadioButton());
         this->heightTextBox = (gcnew System::Windows::Forms::TextBox());
         this->heightLabel = (gcnew System::Windows::Forms::Label());
         this->sizeSendButton = (gcnew System::Windows::Forms::Button());
         this->widthLabel = (gcnew System::Windows::Forms::Label());
         this->widthTextBox = (gcnew System::Windows::Forms::TextBox());
         this->gaugeTabPage = (gcnew System::Windows::Forms::TabPage());
         this->gaugeValueGroupBox = (gcnew System::Windows::Forms::GroupBox());
         this->barValueRadioButton = (gcnew System::Windows::Forms::RadioButton());
         this->label5 = (gcnew System::Windows::Forms::Label());
         this->meterValueRadioButton = (gcnew System::Windows::Forms::RadioButton());
         this->label6 = (gcnew System::Windows::Forms::Label());
         this->arcValueRadioButton = (gcnew System::Windows::Forms::RadioButton());
         this->gaugeValueTrackBar = (gcnew System::Windows::Forms::TrackBar());
         this->trackBarLabel = (gcnew System::Windows::Forms::Label());
         this->tabCollection->SuspendLayout();
         this->outputStringsTab->SuspendLayout();
         this->shapePage->SuspendLayout();
         this->circleAngleGroupBox->SuspendLayout();
         this->lineSuppresionGroupBox->SuspendLayout();
         this->sizeGroupBox->SuspendLayout();
         this->gaugeTabPage->SuspendLayout();
         this->gaugeValueGroupBox->SuspendLayout();
         (cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->gaugeValueTrackBar))->BeginInit();
         this->SuspendLayout();
         // 
         // tabCollection
         // 
         this->tabCollection->Controls->Add(this->outputStringsTab);
         this->tabCollection->Controls->Add(this->shapePage);
         this->tabCollection->Controls->Add(this->gaugeTabPage);
         this->tabCollection->Location = System::Drawing::Point(12, 12);
         this->tabCollection->Name = L"tabCollection";
         this->tabCollection->SelectedIndex = 0;
         this->tabCollection->Size = System::Drawing::Size(827, 396);
         this->tabCollection->TabIndex = 0;
         // 
         // outputStringsTab
         // 
         this->outputStringsTab->BackColor = System::Drawing::Color::White;
         this->outputStringsTab->Controls->Add(this->justificationComboBox);
         this->outputStringsTab->Controls->Add(this->stringSizeDropBox);
         this->outputStringsTab->Controls->Add(this->stringFontLabel);
         this->outputStringsTab->Controls->Add(this->label7);
         this->outputStringsTab->Controls->Add(this->stringSizeLabel);
         this->outputStringsTab->Controls->Add(this->stringBackgroundLabel);
         this->outputStringsTab->Controls->Add(this->fontCheckListBox);
         this->outputStringsTab->Controls->Add(this->greenRadio);
         this->outputStringsTab->Controls->Add(this->blueRadio);
         this->outputStringsTab->Controls->Add(this->whiteRadio);
         this->outputStringsTab->Controls->Add(this->blackRadio);
         this->outputStringsTab->Controls->Add(this->label4);
         this->outputStringsTab->Controls->Add(this->label3);
         this->outputStringsTab->Controls->Add(this->label2);
         this->outputStringsTab->Controls->Add(this->label1);
         this->outputStringsTab->Location = System::Drawing::Point(4, 22);
         this->outputStringsTab->Name = L"outputStringsTab";
         this->outputStringsTab->Padding = System::Windows::Forms::Padding(3);
         this->outputStringsTab->Size = System::Drawing::Size(819, 370);
         this->outputStringsTab->TabIndex = 0;
         this->outputStringsTab->Text = L"Output Strings";
         // 
         // justificationComboBox
         // 
         this->justificationComboBox->FormattingEnabled = true;
         this->justificationComboBox->Items->AddRange(gcnew cli::array< System::Object^  >(3) { L"Left", L"Middle", L"Right" });
#pragma区域Windows窗体设计器生成的代码
/// 
///设计器支持所需的方法-不修改
///此方法的内容与代码编辑器一起使用。
/// 
void初始化组件(void)
{
这->tabCollection=(gcnewsystem::Windows::Forms::TabControl());
这->outputStringsTab=(gcnew System::Windows::Forms::TabPage());
这->justicationComboBox=(gcnew System::Windows::Forms::ComboBox());
this->stringSizeDropBox=(gcnewsystem::Windows::Forms::ComboBox());
这->stringFontLabel=(gcnew System::Windows::Forms::Label());
这->label7=(gcnewsystem::Windows::Forms::Label());
这->stringSizeLabel=(gcnew System::Windows::Forms::Label());
这->stringBackgroundLabel=(gcnew System::Windows::Forms::Label());
此->fontCheckListBox=(gcnew System::Windows::Forms::CheckedListBox());
这->绿色收音机=(gcnew System::Windows::Forms::RadioButton());
这->blueRadio=(gcnew System::Windows::Forms::RadioButton());
这->whiteRadio=(gcnew System::Windows::Forms::RadioButton());
这->blackRadio=(gcnew System::Windows::Forms::RadioButton());
这->label4=(gcnewsystem::Windows::Forms::Label());
这->label3=(gcnewsystem::Windows::Forms::Label());
这->label2=(gcnewsystem::Windows::Forms::Label());
这->标签1=(gcnewsystem::Windows::Forms::Label());
这->shapePage=(gcnew System::Windows::Forms::TabPage());
这->circleAngleGroupBox=(gcnew System::Windows::Forms::GroupBox());
这->CircleangLabel=(gcnew System::Windows::Forms::Label());
此->circleAngleStartTextBox=(gcnew System::Windows::Forms::TextBox());
这->circleAngleEndTextBox=(gcnew System::Windows::Forms::TextBox());
此->circleAngleButton=(gcnew System::Windows::Forms::Button());
这->startAngleLabel=(gcnew System::Windows::Forms::Label());
这->degreesLabel2=(gcnew System::Windows::Forms::Label());
这->endAngleLabel=(gcnew System::Windows::Forms::Label());
这->degreesLabel1=(gcnew System::Windows::Forms::Label());
此->lineSuppresionGroupBox=(gcnew System::Windows::Forms::GroupBox());
这->squareLineLabel=(gcnew System::Windows::Forms::Label());
这->非抑制无线电=(gcnew System::Windows::Forms::RadioButton());
这->topSuppressRadio=(gcnew System::Windows::Forms::RadioButton());
这->bottomSuppressRadio=(gcnew System::Windows::Forms::RadioButton());
这->leftSuppressRadio=(gcnew System::Windows::Forms::RadioButton());
这->rightSuppressRadio=(gcnew System::Windows::Forms::RadioButton());
此->sizeGroupBox=(gcnew System::Windows::Forms::GroupBox());
此->circleRadioButton=(gcnew System::Windows::Forms::RadioButton());
此->ShapeHeightWidthLabel=(gcnew System::Windows::Forms::Label());
这->squareRadioButton=(gcnew System::Windows::Forms::RadioButton());
此->高度文本框=(gcnew System::Windows::Forms::TextBox());
此->高度标签=(gcnew System::Windows::Forms::Label());
此->sizeSendButton=(gcnew System::Windows::Forms::Button());
此->宽度标签=(gcnew System::Windows::Forms::Label());
此->宽度文本框=(gcnew System::Windows::Forms::TextBox());
这->gaugeTabPage=(gcnew System::Windows::Forms::TabPage());
这->gaugeValueGroupBox=(gcnew System::Windows::Forms::GroupBox());
此->barValueRadioButton=(gcnew System::Windows::Forms::RadioButton());
这->label5=(gcnewsystem::Windows::Forms::Label());
此->meterValueRadioButton=(gcnew System::Windows::Forms::RadioButton());
这->label6=(gcnewsystem::Windows::Forms::Label());
此->arcValueRadioButton=(gcnew System::Windows::Forms::RadioButton());
这->gaugeValueTrackBar=(gcnew System::Windows::Forms::TrackBar());
这->trackBarLabel=(gcnew System::Windows::Forms::Label());
此->选项卡集合->SuspendLayout();
此->outputStringsTab->SuspendLayout();
此->shapePage->SuspendLayout();
此->circleAngleGroupBox->SuspendLayout();
此->lineSuppresionGroupBox->SuspendLayout();
此->sizeGroupBox->SuspendLayout();
此->gaugeTabPage->SuspendLayout();
此->gaugeValueGroupBox->SuspendLayout();
(cli::safe_cast(this->gaugeevaluetrackbar))->BeginInit();
此->SuspendLayout();
// 
//tabCollection
// 
此->选项卡集合->控件->添加(此->输出字符串选项卡);
此->选项卡集合->控件->添加(此->形状页面);
此->选项卡集合->控件->添加(此->量规选项卡页);
此->选项卡集合->位置=系统::图形::点(12,12);
此->选项卡集合->名称=L“选项卡集合”;
此->选项卡集合->SelectedIndex=0;
此->选项卡集合->大小=系统::绘图::大小(827396);
此->选项卡集合->选项卡索引=0;
// 
//outputStringsTab
// 
此->outputStringsTab->BackColor=System::Drawing::Color::White
filter ts {l|r|lr|lc count}
filter trimspace lc 5 <"%systemroot%\win.ini"
Set Arg = WScript.Arguments
set WshShell = createObject("Wscript.Shell")
Set Inp = WScript.Stdin
Set Outp = Wscript.Stdout

If LCase(Arg(1)) = "l" then 
    Do Until Inp.AtEndOfStream
        Line=Inp.readline
        outp.writeline LTrim(Line)
    Loop
ElseIf LCase(Arg(1)) = "r" then
    Do Until Inp.AtEndOfStream
        Line=Inp.readline
        outp.writeline RTrim(Line)
    Loop
ElseIf LCase(Arg(1)) = "lr" then
    Do Until Inp.AtEndOfStream
        Line=Inp.readline
        outp.writeline Trim(Line)
    Loop
ElseIf LCase(Arg(1)) = "lc" then
    Count = Cint(LCase(Arg(2)))
    Do Until Inp.AtEndOfStream
        Line=Inp.readline
        If Left(Line,Count) = Space(Count) then
            outp.writeline Mid(Line, Count +1)
        Else
            outp.writeline LTrim(Line)
        End If
    Loop
End If
  cscript //nologo <pathtovbsscript\vbsscript.vbs> lc 5 <file.h
 filter subcommand [parameters]
filter <inputfile >outputfile
filter <inputfile | other_command
other_command | filter >outputfile
other_command | filter | other_command