aspose file tools*
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
JavaRanch » Java Forums » Engineering » General Computing
Bookmark "help for .batch files" Watch "help for .batch files" New topic
Author

help for .batch files

pramod talekar
Ranch Hand

Joined: Apr 26, 2010
Posts: 323

Hello,

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.


Thanks,
Pramod
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 19073
    
  40

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.

Henry


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

Joined: May 14, 2008
Posts: 5845
    
    7

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: 323

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: 323

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

Thanks Peter and Henry.

cheers..
 
 
subject: help for .batch files