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: writing batch files in windows 7

20 Jan 2014   #1
zivshosh

Windows 7 Ultimate x64
 
 
writing batch files in windows 7

Greetings
the following simple one line batch file used to run in Windows XP

fsort.bat
sort %1 /o %~ns.%~x

fsort list.txt would sort the text file list.txt and put the result in lists.txt
now it doesn't run.
it seems that windows 7 doesn't handle parameters like %~n and %~x
What do I do instead?
Where can I find the do's and do not's of batch file in windows 7?
(in xp I used the help. now when I search for batch I get nonsense)
please help


My System SpecsSystem Spec
.
20 Jan 2014   #2
HammerHead

win 7 X64 Ultimate SP1
 
 
Some Help

To start with I will supply an MS link to commands.

Bcdboot

I don't think that is exactly what you are looking for but it will be useful. I will keep looking.
My System SpecsSystem Spec
20 Jan 2014   #3
HammerHead

win 7 X64 Ultimate SP1
 
 
Another Link

Here is another link and some advice.

Windows 7 : Understanding Batch File Basics (part 2) - Using Batch File Parameters - Microsoft Certification Examples, exercises, practises, tutorials, solutions about Windows

In your web search type "Win 7 command line syntax". You will get copious amounts of good links. If I had to read or hunt a lot for the command parameters, I would hunt the syntax and commands for the "power shell" included in windows.
My System SpecsSystem Spec
.

20 Jan 2014   #4
Ztruker

Windows 10 Pro X64
 
 

My System SpecsSystem Spec
21 Jan 2014   #5
zivshosh

Windows 7 Ultimate x64
 
 

Thank you Hammerhead
I was not familiar with this page.
I read it and as you can see under the for command the subvariables %~n and %~x are still in use, thanks God.
That gave me an idea to corrcet my simple one liner fsort.bat file.
here's the final working (!) version of fsort.bat
sort %1 /o %~n1s.%~x1
My System SpecsSystem Spec
21 Jan 2014   #6
zivshosh

Windows 7 Ultimate x64
 
 

Quote   Quote: Originally Posted by HammerHead View Post
Here is another link and some advice.

Windows 7 : Understanding Batch File Basics (part 2) - Using Batch File Parameters - Microsoft Certification Examples, exercises, practises, tutorials, solutions about Windows

In your web search type "Win 7 command line syntax". You will get copious amounts of good links. If I had to read or hunt a lot for the command parameters, I would hunt the syntax and commands for the "power shell" included in windows.
This page is a bit too elementary for me. I also saw part3. but I wan't familiar with this site either, so thanks again.
My System SpecsSystem Spec
Reply

 writing batch files in windows 7




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
How to stop Windows 7 from writing desktop.ini files everywhere?
Hello, so I have issues about hidden files (I always want to see them), and I'm particularly annoyed by this desktop.ini file. As if it wasn't enough that there is one in almost every folder, in Windows 7 there are TWO of them on my desktop! Also, Windows 7 is always trying to burn/write that...
General Discussion
Windows 7 is over-writing files that have a different file name
I have a problem when saving files in Windows 7. say I have a png with the name "alduin & khajiit 1.png" and I highlight it to grab the file name but I change the "1" to a "2" for a file name "alduin & Khajiit 2.png" in the file name field, Windows 7 still asks if I want to overwrite it despite the...
General Discussion
Windows Batch Files are written in Basic?
Hey, This may seem a really obvious question, but aren't Windows Batch files written in Basic? Thanks, Harry
General Discussion
Best Program for Writing Help Files?
Hi, I have been asked to design help files for someone for their program that they are developing. I have been using HTML Help Workshop, but it seems to be badly designed/too complicated to use. What program should I use to create these help files? It should be a free program. Thanks! :geek:
Software
How to stop an app from writing to one of it's files
Hi. :) I have an .xml that is associated with an app. Everytime I shut down the app. that .xml file is written to, which I am trying to avoid, because it is changing some values I want to keep. I have made the file "read only", but that doesn't help; the app automatically switches off the "read...
Software
Questions about writing a batch file.
Hello everyone, I've got some softball questions about writing batch files. 1)What is the proper syntax to include multiple folders in a set path statement? for example I want to run an application called fred.exe and smith.exe. Fred is located at c:\scripts\torrent seeds\july\fred.exe...
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 04:20.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App