Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: batch file

28 Aug 2012   #1

windows 7 ultimate x64
 
 
batch file

hi guys.
i have a question about bach files.
i am learning.
i want to create a bach file that when we run it , it runs a program and saves the programs data as txt file on a specific folder.
i write this batchbelow) file but do not know what is the orders to save the txt file in a specific folder(my batch file save the files in the root of drive)
Code:
start program.exe /stext program.txt


My System SpecsSystem Spec
.

28 Aug 2012   #2

W7 Pro SP1 64bit
 
 

This part of the batch file is called a switch:

start program.exe /stext program.txt

It will not work unless program.exe watches for that switch.

What is the name of the program?
And do you have a link where it can be downloaded?
My System SpecsSystem Spec
28 Aug 2012   #3

windows 7 ultimate x64
 
 

i do not have the name of program.i am learning batch file.and do not test this order for a program yet.but as you said it is switch but it save the txt file in the root that the batch file is.for example if the batch file is in C drive.it creates txt file in C drive.i want to create txt file for example in a folder in desktop
My System SpecsSystem Spec
.


28 Aug 2012   #4

W7 Pro SP1 64bit
 
 

maybe:

start program.exe /stext c:\users\username\desktop\program.txt
My System SpecsSystem Spec
28 Aug 2012   #5

windows 7 ultimate x64
 
 

i found a program to test.
WirelessKeyView: Recover lost WEP/WPA key/password stored by Wireless Zero Configuration service
i test your answer but it does not work.
My System SpecsSystem Spec
28 Aug 2012   #6

W7 Pro SP1 64bit
 
 

Please post the exact code that you tried.
My System SpecsSystem Spec
28 Aug 2012   #7

Microsoft Community Contributor Award Recipient

Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1
 
 

Don't use "start"! And redirecting output to file instead of console is done by using >

dir > %userprofile%\desktop\output.txt

To output error messages and well:
dir > %userprofile%\desktop\output.txt 2>&1

To add output to some file
dir >> %userprofile%\desktop\output.txt

source: Microsoft Corporation
My System SpecsSystem Spec
28 Aug 2012   #8

windows 7 ultimate x64
 
 

Quote   Quote: Originally Posted by UsernameIssues View Post
Please post the exact code that you tried.
start WirelessKeyView.exe /stext c:\users\omidreza\desktop\WirelessKeyView.txt

Quote   Quote: Originally Posted by Kaktussoft View Post
Don't use "start"! And redirecting output to file instead of console is done by using >

dir > %userprofile%\desktop\output.txt

To output error messages and well:
dir > %userprofile%\desktop\output.txt 2>&1

To add output to some file
dir >> %userprofile%\desktop\output.txt

source: Microsoft Corporation
i did not understand what you said.can you please write the codes as a batch file for my example
My System SpecsSystem Spec
28 Aug 2012   #9

Microsoft Community Contributor Award Recipient

Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1
 
 

Do you want to redirect output or error messages or both? If both.... to same file?

dir>%userprofile%\desktop\output.txt

Put that in a bat file and run it. a file output.txt appears on desktop
My System SpecsSystem Spec
28 Aug 2012   #10

W7 Pro SP1 64bit
 
 

Quote   Quote: Originally Posted by muiacir View Post
Quote   Quote: Originally Posted by UsernameIssues View Post
Please post the exact code that you tried.
start WirelessKeyView.exe /stext c:\users\omidreza\desktop\WirelessKeyView.txt
This application does not support a full path in front of the output file. If you want the txt file to be on your desktop, then move the file named WirelessKeyView.exe to your desktop and try this:

c:\users\omidreza\desktop\WirelessKeyView.exe /stext WirelessKeyView.txt
My System SpecsSystem Spec
Reply

 batch file




Thread Tools




Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 03:33 PM.
Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33