I saw a simple code in some book that suppose to return a list of file and folder names at the root of c:\ with a prefix of 'n - (file/folder name)' . ('n' as file\folder number of the list).
I tried to run this on cmd and on powershell 5 both output is: "my old windows shell script" "was unexpected at this time"
EDIT************************** the purpose is to run this as .cmd file in both cmd and in PS EDIT**************************
@echo off
echo my old windows shell script
set x=0
for /f "tokens=*" %%i in ('DIR /b C:\') do call :output "%%i"
echo script complete!
goto :EOF
:output
set name=%1
set /A X=X+1
echo %X% = %name%
goto :EOF