This is literally my very first line of code I’ve ever written and its not worked.
I’ve opened a .bat file in VS called “second.bat”
typed: echo “hello, world!!”
then gone to the terminal and run the code.
but instead of printing “hello world!!” it has come up with the following error message:
Program 'second.bat' failed to run: The specified executable is not a valid application for this OS platform.At line:1 char:1
+ .\second.bat
+ ~~~~~~~~~~~~.
At line:1 char:1
+ .\second.bat
+ ~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (:) [], ApplicationFailedException
+ FullyQualifiedErrorId : NativeCommandFailed
I’m running a 64-bit operating system, x64-based processor. Windows 11 Home.
I tried googling the answer but cannot find anything that makes sense to a total beginner.
“then gone to the terminal and run the code.” Which “terminal”? The error looks like a typical PowerShell error but batch files are interpreted by command prompt (cmd.exe) on Windows.
Could you also clarify how you ran the code?
i ran it withing the VS terminal. Clicked the “terminal” tab at the top of the window then clicked new terminal.
To run the code I entered the terminal. It was already directed to the correct folder/directory. Then I typed the .bat file name withing that folder (second.bat) and pressed enter.
There should be a little
+v
on the right side of the terminal. If you click on thev
, you can selectCommand Prompt
and open an actual cmd window. Right now, you’re looking at a powershell window, and those are different languages.Show 2 more comments