writing batch files in windows 7

zivshosh

New member
Local time
5:37 PM
Messages
21
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 Computer

Computer type
PC/Desktop
OS
Windows 7 Ultimate x64
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 Computer

Computer Manufacturer/Model Number
BGC (Bob's Garage Crew)
OS
win 7 X64 Ultimate SP1
CPU
I3770K
Motherboard
Asus P8Z77-V Deluxe
Memory
G Skill F3-14900CL9-4GBXL x 4
Graphics Card(s)
NVIDIA GeForce GTX670 + Intel 4000
Sound Card
Realtek HD 5.1 (MOB)
Monitor(s) Displays
Asus VW224T (1)
Screen Resolution
1920 x 1080
Hard Drives
SATA Corsair Force GT 2.5" 180GB (System) Sata 3
OCZ Vertex3 120GB
OCZ Vertex 2 120GB 2.5" SATA II
ST31000524AS 1000.2GB
WD15EARS (External)
PSU
CoolerMaster 1000 Watt
Case
CoolerMaster HAF X
Cooling
CPU -- CoolerMaster 520N
Keyboard
MS Wireless 3000 V2
Mouse
MS Wireless 3000 V2
Internet Speed
Cable
Antivirus
Norton Internet Security
Browser
IE9
Other Info
AMI Bios 1805
OC'd 3%

My Computer

Computer Manufacturer/Model Number
BGC (Bob's Garage Crew)
OS
win 7 X64 Ultimate SP1
CPU
I3770K
Motherboard
Asus P8Z77-V Deluxe
Memory
G Skill F3-14900CL9-4GBXL x 4
Graphics Card(s)
NVIDIA GeForce GTX670 + Intel 4000
Sound Card
Realtek HD 5.1 (MOB)
Monitor(s) Displays
Asus VW224T (1)
Screen Resolution
1920 x 1080
Hard Drives
SATA Corsair Force GT 2.5" 180GB (System) Sata 3
OCZ Vertex3 120GB
OCZ Vertex 2 120GB 2.5" SATA II
ST31000524AS 1000.2GB
WD15EARS (External)
PSU
CoolerMaster 1000 Watt
Case
CoolerMaster HAF X
Cooling
CPU -- CoolerMaster 520N
Keyboard
MS Wireless 3000 V2
Mouse
MS Wireless 3000 V2
Internet Speed
Cable
Antivirus
Norton Internet Security
Browser
IE9
Other Info
AMI Bios 1805
OC'd 3%

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Lenovo IdeaCenter 450
OS
Windows 10 Pro X64
CPU
Intel Quad Core i7-4770 @ 3.4Ghz
Memory
16.0GB PC3-12800 DDR3 SDRAM 1600 MHz
Graphics Card(s)
Intel Integrated HD Graphics
Sound Card
Realtek HD Audio
Monitor(s) Displays
HP 22" LCD
Screen Resolution
1680 x 1050
Hard Drives
250GB Samsung EVO SATA-3 SSD
2TB Seagate ST2000DM001 SATA-2
1.5TB Seagate ST3150041AS SATA
Keyboard
Dell USB
Mouse
Lenovo USB
Internet Speed
Cable via Road Runner 3MB Upload, 30MB Download
Antivirus
Windows Defender, MBAM Pro, MBAE
Browser
Seamonkey
Other Info
UEFI/GPT
PLDS DVD-RW DH16AERSH
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 Computer

Computer type
PC/Desktop
OS
Windows 7 Ultimate x64
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 Computer

Computer type
PC/Desktop
OS
Windows 7 Ultimate x64
Back
Top