Solved I can't run bat and cmd files.


Please note that technically, there is no "Cmd window" or "PowerShell window". It's either a Console Host window or a Terminal window.

On Windows 10, by default, Cmd.exe and PowerShell.exe run in the Console Host (conhost.exe).

On Windows 11, by default, Cmd.exe and PowerShell.exe run in Windows Terminal (wt.exe).

Therefore, your batch file should, by default, run in a tabbed Terminal window and look like this:

View attachment 89340

If you run your batch file with "Run as Administrator", then it should open in Console Host and look like this:

View attachment 89343

The batch file will run the same regardless of the host. It's the same Cmd.exe interpreter either way.
True, but it does not show the results of the batch file operation - i.e. if I ping 10 times, they don't show. The only way to get it to work is open a command window and enter the command there.
 

My Computer

System One

  • OS
    Windows 11 Pro; 21H2, Build 22000.1281
    Computer type
    Laptop
    Manufacturer/Model
    Dell 3525
    CPU
    AMD Ryzen 3 3250 with Radeon Graphics
    Memory
    8gb
    Graphics Card(s)
    AMD Graphics
    Sound Card
    AMD high definition audio device; Realtek audio
    Screen Resolution
    1980x1020
True, but it does not show the results of the batch file operation - i.e. if I ping 10 times, they don't show. The only way to get it to work is open a command window and enter the command there.
That's unexpected. Try switching the default to Console Host and verify that it works correctly and then try switching it back to Terminal and see if the problem returns. Here's the tutorial for making the switch:

 

My Computer

System One

  • OS
    Windows 10/11
    Computer type
    Laptop
    Manufacturer/Model
    Acer
That is a cmd window within Terminal.
I have no idea why that might appear when a batch file is being run from within File explorer. Mine do not. They appear as in my posted screenshots. You'll have to listen to Les about this topic.

I can't do a print screen any more, it opens snipping tool
That, as I understand it, is a setting somewhere.
I know nothing about it because I use a shortcut, script & a third-party utility for my screenshots [and it all allows delays and that's what allows me to capture dropdown menus].


Denis
 

My Computer

System One

  • OS
    Windows 11 Home x64 Version 23H2 Build 22631.3447
That's unexpected. Try switching the default to Console Host and verify that it works correctly and then try switching it back to Terminal and see if the problem returns. Here's the tutorial for making the switch:

Still does not show the results of the batch file in the window - turns off the batch file and opens a new command window:
Screenshot 2024-03-06 112524.png
 

My Computer

System One

  • OS
    Windows 11 Pro; 21H2, Build 22000.1281
    Computer type
    Laptop
    Manufacturer/Model
    Dell 3525
    CPU
    AMD Ryzen 3 3250 with Radeon Graphics
    Memory
    8gb
    Graphics Card(s)
    AMD Graphics
    Sound Card
    AMD high definition audio device; Realtek audio
    Screen Resolution
    1980x1020
That is a cmd window within Terminal.
I have no idea why that might appear when a batch file is being run from within File explorer. Mine do not. They appear as in my posted screenshots. You'll have to listen to Les about this topic.


That, as I understand it, is a setting somewhere.
I know nothing about it because I use a shortcut, script & a third-party utility for my screenshots [and it all allows delays and that's what allows me to capture dropdown menus].


Denis
I finally found the setting under Accessibility > Keyboard > Use the print screen key to open screen capture - turn off.
 

My Computer

System One

  • OS
    Windows 11 Pro; 21H2, Build 22000.1281
    Computer type
    Laptop
    Manufacturer/Model
    Dell 3525
    CPU
    AMD Ryzen 3 3250 with Radeon Graphics
    Memory
    8gb
    Graphics Card(s)
    AMD Graphics
    Sound Card
    AMD high definition audio device; Realtek audio
    Screen Resolution
    1980x1020
On Windows 11, by default, Cmd.exe and PowerShell.exe run in Windows Terminal (wt.exe).
If I right-click on the Start menu & select PowerShell, I go straight to a PS window
Start, PS, PS window - Win11.png


Denis
 

My Computer

System One

  • OS
    Windows 11 Home x64 Version 23H2 Build 22631.3447
Still does not show the results of the batch file in the window - turns off the batch file and opens a new command window
Correct.
It is doing what your chosen commands have told it to do.
- The Start cmd opens the second window.
- The pinging all happens in the second window.
- There are no further actions in the first window other than proceeding to the pause line.


And, as I said before, I do not know why you are using a Start command. It appears to me to be unproductive and it complicates the picture.


Denis
 

My Computer

System One

  • OS
    Windows 11 Home x64 Version 23H2 Build 22631.3447
LesFerch said:
On Windows 11, by default, Cmd.exe and PowerShell.exe run in Windows Terminal (wt.exe).
Only if this is selected as Default Terminal Application, which is not on the system below:

Screenshot 2024-03-06 180613.jpg
 

My Computers

System One System Two

  • OS
    Win11 All /Debian/Arch
    Computer type
    Laptop
    Manufacturer/Model
    ASUSTeK COMPUTER INC. TUF Gaming FX705GM
    CPU
    2.20 gigahertz Intel i7-8750H Hyper-threaded 12 cores
    Motherboard
    ASUSTeK COMPUTER INC. FX705GM 1.0
    Memory
    24428 Megabytes
    Graphics Card(s)
    Intel(R) UHD Graphics 630 / NVIDIA GeForce GTX 1060
    Sound Card
    Intel(R) Display Audio / Realtek(R) Audio
    Monitor(s) Displays
    Integrated Monitor (17.3"vis)
    Screen Resolution
    FHD 1920X1080 16:9
    Hard Drives
    2 SSD SATA/NVM Express 1.3
    WDS500G2B0A-00SM50 500.1 GB
    WDCSDAPNUW-1002 256 GB
    PSU
    19V DC 6.32 A 120 W
    Cooling
    Dual Fans
    Mouse
    MS Bluetooth
    Internet Speed
    Fiber 1GB Cox -us & ADSL Bouygues -fr
    Browser
    Edge Canary- Firefox Nightly
    Antivirus
    Windows Defender
    Other Info
    VMs of Windows 11 stable/Beta/Dev/Canary
    VM of XeroLinux- Arch based & Debian 12
  • Operating System
    Windows 11 Insider Canary
    Computer type
    Laptop
    Manufacturer/Model
    ASUS X751BP
    CPU
    AMD Dual Core A6-9220
    Motherboard
    ASUS
    Memory
    8 GB
    Graphics card(s)
    AMD Radeon R5 M420
    Sound Card
    Realtek
    Monitor(s) Displays
    17.3
    Screen Resolution
    1600X900 16:9
    Hard Drives
    1TB 5400RPM
Found a way to keep the results window open: start "" cmd /k ping -n 3 192.168.1.70

But that is not the answer because the .bat starts in one window and then switches to another one for the results so that there are two windows open.
 

My Computer

System One

  • OS
    Windows 11 Pro; 21H2, Build 22000.1281
    Computer type
    Laptop
    Manufacturer/Model
    Dell 3525
    CPU
    AMD Ryzen 3 3250 with Radeon Graphics
    Memory
    8gb
    Graphics Card(s)
    AMD Graphics
    Sound Card
    AMD high definition audio device; Realtek audio
    Screen Resolution
    1980x1020
Finally the answer - simply remove "start" from the command as I have always used in other versions of windows:

Before:
start "" cmd /k ping -n 3 192.168.1.70
Pause

After:
cmd /k ping -n 3 192.168.1.70
Pause
 

My Computer

System One

  • OS
    Windows 11 Pro; 21H2, Build 22000.1281
    Computer type
    Laptop
    Manufacturer/Model
    Dell 3525
    CPU
    AMD Ryzen 3 3250 with Radeon Graphics
    Memory
    8gb
    Graphics Card(s)
    AMD Graphics
    Sound Card
    AMD high definition audio device; Realtek audio
    Screen Resolution
    1980x1020

My Computer

System One

  • OS
    Windows 11 Pro; 21H2, Build 22000.1281
    Computer type
    Laptop
    Manufacturer/Model
    Dell 3525
    CPU
    AMD Ryzen 3 3250 with Radeon Graphics
    Memory
    8gb
    Graphics Card(s)
    AMD Graphics
    Sound Card
    AMD high definition audio device; Realtek audio
    Screen Resolution
    1980x1020
"Finally"?????
The second window appears in response to the Start command. I don't know what your objective is so I don't know why you did that. The script could otherwise just be
ping -n 10 192.168.1.70
Pause
or
ping -n 10 192.168.1.70


What is your overall objective, what job is the pinging part of?


Denis
 
Last edited:

My Computer

System One

  • OS
    Windows 11 Home x64 Version 23H2 Build 22631.3447
"Finally"?????



What is your overall objective, what job is the pinging part of?


Denis
Finally means that a single command window opening.

My printer is in another room and has a tendency drop offline so I always check before trying to print.
 

My Computer

System One

  • OS
    Windows 11 Pro; 21H2, Build 22000.1281
    Computer type
    Laptop
    Manufacturer/Model
    Dell 3525
    CPU
    AMD Ryzen 3 3250 with Radeon Graphics
    Memory
    8gb
    Graphics Card(s)
    AMD Graphics
    Sound Card
    AMD high definition audio device; Realtek audio
    Screen Resolution
    1980x1020
Back
Top Bottom