Question: A program returns a version string of this regex type `[0-9]{1,}\.[0-9]{1,}\.[0-9]{1,}\.[0-9]{1,}` on the command line. Therefore the output looks like this:

```
C:\users\user\desktop>a.exe --version
Version: 1.22.53.4134

```

I save the output to a variable `Version` by this **get-version-info.bat**

```
for /f "usebackq tokens=1* delims=: " %%i in (`a.exe --version`) do (
    if /i "%%i"=="Version" set "Version=%%j"
)

```

To solve my exact problem I only need the **major** and **minor** release number(s), but a general, adaptable solution would be also good of course.

How to get major and minor version number of the program in batch file?

Answer: 
Declare the getContext() method and derive it from container.

```
public class Men extends Fragment {

RecyclerView my_recyclerView1;
ArrayList<Tab_1_DataActivity> tab1;
Context context;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
 context = container.getContext();
 //put the rest of your code and put context in place of getContext or getActivity
   }
}

```
**Use this code ....**

```
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.activity_tab_1, container, false); // add line
    my_recyclerView1 = (RecyclerView) view .findViewById(R.id.tab1_recyclcer); // change line
    my_recyclerView1.setLayoutManager(new LinearLayoutManager(getActivity())); // change line
    tab1 = new ArrayList<>();
    loadData();
    return view; // change line
}

```

**Change these lines also ...**

```
MenAdapter my_recyclerView1Adapter = new MenAdapter(getActivity(), tab1);//change line
                my_recyclerView1.setAdapter(my_recyclerView1Adapter);

```