Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to run (Task Scheduled) batch file NOT in legacy mode #247

Open
dominicraf opened this issue Dec 1, 2023 · 3 comments
Open

How to run (Task Scheduled) batch file NOT in legacy mode #247

dominicraf opened this issue Dec 1, 2023 · 3 comments

Comments

@dominicraf
Copy link

I am using NTVDMx64 and it continues to be fantastic, many thanks. The same machine has WSLv1 (I tried WSLv2 and it broke my system, so reverted).

This machine also has a batch file (.bat) that runs from Task Scheduler. This does not need NTVDMx64 and indeed doesn't like the legacy mode, I think because, inside the code, it uses WSL. It runs perfectly from Terminal, but from a Command Prompt (cmd) - and also when run from Task Scheduler - I see error messages when it attempt to call WSL like:
Unsupported console settings. In order to use this feature, the legacy console must be disabled.

What I would like is a way to force the batch file (as a Task Scheduler job) to be run through Terminal (or at any rate not using the legacy console). Is this possible? TIA

@dominicraf
Copy link
Author

To answer my own question, I think it works in Task Scheduler if I specify wt.exe as the Program/Script and the actual batch file (and parameters) under 'Add arguments (optional):'

@dominicraf
Copy link
Author

dominicraf commented Jan 11, 2024

To update/correct my previous answer, the way to do it in Task Scheduler is actually to specify cmd.exe as the Program/Script and then something like /c "start wt -d . \path\to\my.bat /myswitch1" under 'Add arguments (optional)'

@leecher1337
Copy link
Owner

Great!
As a sidenote to those who are forced to have a working V2 console, you can theoretically reset
HKEY_CURRENT_USER\Console ForceV2 back to 1 (Windows default).
It has the huge drawback that you cannot start DOS applications in the same cmd.exe window if the current console is running as a v2 console (which would be default then), so no "seamless" integration, but it would then open a seperate console window with the DOS application that runs a V1 console.
This was introduced in 4d67e3f
Not very convenient, so not recommended, but it should work as a fallback solution.

Your solution obviously is better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants