Windows 7 64-Bit - Running Batch Files

Talk Electrician Forum

Help Support Talk Electrician Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

OnOff

Mad Inventor™
Supporting Member
Joined
Dec 25, 2011
Messages
5,468
Reaction score
78
My 14 year old is having problems running batch files he's written. Last time I messed about with them was under DOS in the 80's! Anyway he's creating the batch file in Notepad and saving as a .bat. To try and run he double clicks in the folder and the editor just briefly flashes up on screen or with the correct path does it via CMD and gets this come up:



This is his file:

java -Xms512M -Xmx1G -jar TFCLauncher.jar

Any suggestions appreciated!

Incidentally every batch file he writes OR downloads has the same error message come. He reckons though it USED to work OK i.e ones he's written OR downloaded ones.

Cheers

 
You don't need the "run"

Just "start.bat" will run the file start.bat

or START start.bat will run it in a new window.

Open a command prompt and type HELP to get a list of all the valid command promt commands.

 
You don't need the "run"

Just "start.bat" will run the file start.bat

or START start.bat will run it in a new window.

Open a command prompt and type HELP to get a list of all the valid command promt commands.
Cheers, yep, tried just start.bat without "run" and no joy still...............................

 
I've just written a basic batch file under Win7 64 Bit & run it OK?

Is he using commands that are no longer present in Win7?

Also he will need to run them from a cmd prompt, not by double clicking the .bat file.

 
rename it to something other than start.bat.

Perhaps that is conflicting with the inbuilt command start?

P.S,

As long as it is called start.bat, then you do need to type start.bat.  Just typing start, opens a new command prompt in a new window.

Perhaps W7 deals with things differently and can't handle two things called start?

Normally if there is no conflict, then you don't need to type the .bat bit

Why not list the contents of start.bat here for us to pick over?

 
Last edited by a moderator:
I usually right click the folder containing the bat file and open an elevated command. Then type in (using your example) start.bat and hit enter.

I've just renamed my "language_clean.bat" file to "start.bat" and it ran no problem.

Add Open Elevated Command to Context Menu. Save code as .reg file and merge:

Code:
Windows Registry Editor Version 5.00;"My" Computer in Start Menu[-HKEY_CLASSES_ROOT\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\cmd][HKEY_CLASSES_ROOT\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\CMD Puter]@="Open Elevated Cmd""Icon"="C:\\windows\\System32\\cmd.exe"[HKEY_CLASSES_ROOT\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\CMD Puter\command]@="cmd.exe /s /k pushd \\\"%V\\\"";Drives/Partitions[-HKEY_CLASSES_ROOT\Drive\shell\cmd][HKEY_CLASSES_ROOT\Drive\shell\CMD Drive]@="Open Elevated Cmd""Icon"="C:\\windows\\System32\\cmd.exe"[HKEY_CLASSES_ROOT\Drive\shell\CMD Drive\command]@="cmd.exe /s /k pushd \"%V\"";Folders[-HKEY_CLASSES_ROOT\directory\shell\cmd][HKEY_CLASSES_ROOT\directory\shell\CMD Directory]@="Open Elevated Cmd""Icon"="C:\\windows\\System32\\cmd.exe"[HKEY_CLASSES_ROOT\directory\shell\CMD Directory\command]@="cmd.exe /s /k pushd \"%V\""
 
Last edited by a moderator:


This is his file:

java -Xms512M -Xmx1G -jar TFCLauncher.jar

Any suggestions appreciated!
Just noticed a typo between what is being entered as per your image "his file name" TFCLancher and "his actual file name" TFCLauncher.jar

Also, very occasionally I've had to add the drive letter at the end, after a space, that I want the bat file to take action on. a.k.a start.bat C  or start.bat D etc..

 
I have absolutely nothing worthwhile to add to this topic,

but I just wanted to make a smart comment

try

sudo apt-delete W7or 

Code:
rm rf
 
Last edited by a moderator:
Cheers for the replies. Will have another go later and try some of the suggestions. I went in a minute ago but he's mid "quest" or something and seemingly couldn't stop!

 
You definitely don't need to use the 'run' command to launch the batch file, as long as the working directory is changed to the the directory containing the batch file you should just be able to type the name of the file and hit return. Or, actually go into the TFCLancher folder on the desktop and double click on the file itself to launch.

If you don't get and error or you see a cmd prompt flash up and disappear before you can read it then put a 'pause' command in the batch file itself:

java -Xms512M -Xmx1G -jar TFCLauncher.jar

pause

This will hold the cmd prompt on your screen until you press a key to continue, it'll give you a chance to see any error contained in the cmd prompt.

As has been mentioned already, you can see a list of supported commands by typing Help at the prompt, you can also see usage of a particular command by using '/?' after it i.e. Start /?

 
Last edited by a moderator:
The lad has sorted it some 2 months down the line...................seems he was running the WRONG bit version of Java for a start!

 
Well done. you have reached 10 posts. now you can stop posting pointless replies to old threads.

I look forward to some constructive input.

welcome to the forum

 
Top