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
muiacir

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
UsernameIssues

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
muiacir

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
UsernameIssues

W7 Pro SP1 64bit
 
 

maybe:

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

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
UsernameIssues

W7 Pro SP1 64bit
 
 

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

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
muiacir

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
Kaktussoft

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
UsernameIssues

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





Similar help and support threads
Thread Forum
How can I write a batch file that opens a file in a program?
I wrote this batch file which does what I want it to do so far. @echo off "C:\Users\xxxxxx\Documents\HideTaskbar\HideTaskbar.exe" "C:\Program Files (x86)\VideoLANold\VLC\vlc.exe" "C:\Users\xxxxxx\Documents\HideTaskbar\ShowTaskbar.exe" exit
General Discussion
I need a batch file to open a random file within a certain folder/path
I want a batch to select and open a random link file in a folder i have. All the links are music videos I like to listen to, and I kind of want to just have an option for 'surprise me!'. I can change the file names if I have to, and I have a basic batch file ability. I know the simple commands,...
General Discussion
How to run a batch file at logoff & some batch scripting help please
Hiya, I'd just like to run a simple batch file at logoff to backup some settings. I plan to use Robocopy, which is what i use to more thorough backups. Two questions: 1. How make it run by clicking Start > Shutdown? (i realise i could make a shutdown batch file and run it instead, but i'd...
Backup and Restore
Batch File that grabs file names from folder to insert into batch file
Ok I'm totally at a loss on how to word this so I'm just going to write it out the best that I can... :confused: First I have a batch file that I'm writing that will convert mp4 files to mp3 files (I have a lot) for a buddies band using ffmpeg. Here's the code that I'm using: ffmpeg -i...
General Discussion
batch file open file for program in the startup folder
I have a computer that is a drone specifically for an outside LED sign. This computer is designed to never shut off and doesn't have any other program on it besides Operating System and the sign software. I need to create a batch file that I can place in the "start-up" folder that will open the...
General Discussion
How to create a batch file that will move files based on the file type
How to create a batch file that will move files based on the file type? My Requirement : I need a batch file to copy all .doc files in all my HardDisk to a removable disk say (Z: drive) . Can anyone make it possible using a batch file?Please...Its urgent...
General Discussion

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 15:19.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App