Library for Win32 console commands

Is there a good Python library for win32 console commands ? I am speaking about python code for the most popular win32 console commands. I release I can call generic commands through the os or subprocess modules but I am looking for a library of win32 console commands I can call directly in Python. I am trying to convert some Windows CMD batch files to Python.

I am new to Python but if you are able to call the Windows API then see Console Reference - Windows Console | Microsoft Docs. That describes the classical console API. Microsoft has developed a new console system called pseudo consoles that are much more like Linux consoles but the Microsoft solution is (currently) too complicated.

Or better yet look at Curses Programming in Python | DevDungeon. I evidently found that 3 months ago and forgot about it. It works for me in Windows.

I don’t think Edward wants console API functions or Curses. He’s converting CMD scripts (i.e. batch scripts) to Python, so I presume he wants a library that provides equivalents to CMD’s internal commands such as copy, as well as external command-line interface (CLI) commands such as “xcopy.exe”. Calling them “win32 console commands” is unusual, at least to me, but they’re typically used in a console/terminal session with standard I/O opened for console files. Anyway, I don’t know of a library that’s designed to facilitate porting batch scripts. I think this will have to be solved on a case by case basis.

Yes the question is unclear. I apologize for misunderstanding.

For console read and write and such pywin32 is the most common library.

For the command shell there are internal and external commands. The internal commands, such as directory listings, can be executed by executing cmd.exe and using the command as an argument. External commands such as xcopy can be executed directly. The tricky part is that the input and output must be redirected, at least the output. And the output might need to be parsed, but since it is command prompt (.bat) files being converted the redirection and processsing of output might not be necessary.

Yes it depends on each command what an equivalent might be.

Hope your question was answered! :pray: