make a batch file type

February 22, 2011 at 07:44:58
Specs: Windows 7
i want a batch file to type directry into a text file. not just a pipe to it. the program would have to slect the notpad and then type in it.

See More: make a batch file type

Report •

February 22, 2011 at 10:49:49
ceate a batch file with below code and execute from any folder.

it will create a text file with your name, open it notepad and then type all the directory contains in it. finally save the contens as well.

@echo off >sinsammy.txt
echo Set WshShell = WScript.CreateObject("WScript.Shell") >temp.vbs
echo "notepad sinsammy.txt" >>temp.vbs
echo wscript.sleep 500 >>temp.vbs
echo wshshell.AppActivate "sinsammy.txt - notepad" >>temp.vbs
for /f "tokens=*" %%a in ('dir /b') do (
echo wshshell.sendkeys "%%a">>temp.vbs
echo wshshell.sendkeys "{enter}">>temp.vbs
echo wscript.sleep 10 >>temp.vbs
echo wshshell.sendkeys "^s">>temp.vbs

cscript /nologo temp.vbs


Subhash Chandra.

Report •
Related Solutions

Ask Question