0
On a Windows 2012 Server, from a logged-in Administrator (local and domain), created a batch file "test.bat" by redirecting console input into a file:
echo Hello
When run from PowerShell cmd prompt as .\test.bat
, it echoes:
'■e' is not recognized as an internal or external command,
Batch file is in logged-in user's C:\users\%username% directory.
The file was created from console, thus:
echo "echo Hello" > test.bat
and then edited with Notepad. Looked alright in Notepad... nothing unusual.
Any ideas as to what's going on?
EDITED:
Per suggestion, I modified command line input to remove quotes. Therefore, entered the command like this: echo echo Yowzer > test.bat
Ran as: .\test.bat
and got the same response as above. Also note that if I edit in Notepad the above test.bat (i.e. created at cmd line) and re-run, it still returns a garbage response. However, if I create/save the file in Notepad from the start, it works correctly.
Can anyone duplicate this?
"C:\users%username%"?? not in subdir like documents? did you cd into the folder that contains the bat file and then run ".\test bat"? And you are executing this from a poweshell console right? – Logman – 2014-06-30T23:47:04.620
The bat file was both created and run from C:\subdir. Two methods were used to create the bat file: (1)
echo stuff > bat.bat
from keyboard, and (2) write in Notepad++ and save as bat file. All cmd prompt activity was done from a PoSH console. – user340089 – 2014-07-03T16:48:09.383-1 for abandoning the question, thus decreasing its value – barlop – 2015-11-08T02:56:04.337