This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes General Computing and the fly likes help for .batch files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » General Computing
Bookmark "help for .batch files" Watch "help for .batch files" New topic

help for .batch files

pramod talekar
Ranch Hand

Joined: Apr 26, 2010
Posts: 316


I'm going through batch files creation for understanding Ant.

I wrote the following code in Notepad and saved it correctly as Listofprograms.bat (Save as Type : All Files)

but I'm not able to save it under C drive as it says permission not granted, would you like to save it in other location ?

This despite, I'm being the only Admin and User of my machine (win 7 OS).
Also after saving in another location, if I run it in command prompt. it shows "Access is denied!".

Please advise.

Henry Wong

Joined: Sep 28, 2004
Posts: 18499

You probably don't have write permission for the top level directory. In fact, I believe by default, you shouldn't have such permission.

Try writing somewhere else instead. Since you are the admin, you can change the properties for the root directory, but it's probably not a good idea, as it was probably done to protect you from accidentally deleting the operating system.

Regardless, this is not Java related. Moving to the general computing forum.


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Peter Johnson

Joined: May 14, 2008
Posts: 5811

I'm being the only Admin and User of my machine (win 7 OS)

Even admin users on Win7 have restricted rights. You can try opening a Command Prompt with the "Run as Administrator" option (right-click on Command Prompt in the Start menu to see this option). But Henry's advice is still the best - create some subdirectory under the root directory and do all of your work there.

JBoss In Action
pramod talekar
Ranch Hand

Joined: Apr 26, 2010
Posts: 316

Hi Peter and Henry,

I created a folder Testbatchfiles under the C drive and was able to save the batch file there.
But running the code still shows "Access is denied!".
pramod talekar
Ranch Hand

Joined: Apr 26, 2010
Posts: 316

please ignore the previous message.
I'm able to run it after selecting Run as Administrator.

Thanks Peter and Henry.

I agree. Here's the link:
subject: help for .batch files
Similar Threads
Running java program from another java program
Posting one selected option value in two forms
Relative directory issues
Need Help With Batch File Scripting Language to Straighten Out PATH Problem in Windows Environment
Save file without unwanted extensions