0

I have written below given query and opening notepad from cmd, but even I want few things to be pasted when this notepad opens.

These things will be in my initial notepad and once I run this bat file this should open a new notepad and paste things.

ECHO OFF

CLS
:MENU
ECHO.
ECHO ...............................................
ECHO Welcome To System.
ECHO ...............................................
ECHO.
ECHO 1 - New Session
ECHO 2 - Another Session
ECHO 3 - EXIT Session
ECHO.
CHOICE /C:123
IF ERRORLEVEL 1 SET M=1
IF ERRORLEVEL 2 SET M=2
IF ERRORLEVEL 3 SET M=3

IF %M%==1 GOTO NEW
IF %M%==2 GOTO ANO
IF %M%==3 GOTO EOF

:NEW
cd D:\Users\gyaneshwar.b
Tree
GOTO MENU
:ANO
cd C:\Program Files\Google\Chrome\Application\chrome.exe
start chrome.exe

GOTO MENU
  • You can write the content into a temporary file and load that file with notepad – Gerald Schneider Aug 20 '15 at 10:52
  • Thanks Gerald, how ? could you help me out. – gyan Aug 20 '15 at 10:55
  • can I have the content in seperate excel sheet and import it? – gyan Aug 20 '15 at 10:56
0

As Gerald has originally hinted:

  1. Output the content you wanted into a text file

    echo text goes here >> file.txt
    echo more text goes here >> file.txt

  2. start notepad.exe file.txt - this should open the file you created in notepad

To address your additional question in the comments: don't use excel proprietary format (.xls) as it won't be readable in text editor like notepad. You can use CSV (comma separated value) format, which can be read by text editor, and excel can understand and parse it properly too as if it is a standard excel sheet.

  • Thanks, but I need just a paste command. My idea is given below: 1) first I will run the above command and insted of notepad it will open a application. 2) after application opens it should take data example . dat 1 , data 2 from that excel sheet and paste first data in the search button of that application . 3) once it is pasted I need a command which will act as enter button. 4) once I close the application this process should repeat again. – gyan Aug 20 '15 at 11:55
  • for Example if now you run this code and hit option 2 . it will open chrome so I want default Data ( Example: URL) to be fetched from seperate excel sheet and enter it in chrome search panel and automatically hit enter. – gyan Aug 20 '15 at 12:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.