remove directory W7 batch getting Access denied

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Rod
Posts: 5
Joined: 13 Dec 2010 12:33

remove directory W7 batch getting Access denied

#1 Post by Rod » 13 Dec 2010 12:56

Hi,

Have been using a simple batch file for years running XP called from within a DOS app using start command, which calls following code to ftp records to my website. However, with new computer on w7 Ultimate, getting access denied on rd command, and thing fails. Here is current code...

@echo off
c:
cd\sd\10
if exist c:\sd\td\ftpc del c:\sd\td\ftpc
if exist c:\sd\wt goto gtfp
goto end
:gtfp
**** note*** sf.exe builds a list of files with path for processing
c:\sd\01\sf c:\sd\wt\ *.* >c:\sd\td\ftpc
***** e.exe **** editor formats the list for ftp op based on macros in 00904
c:\sd\01\e c:\sd\td\ftpc c:\sd\03\00904
***** ftp ***** list of stuff to welchco and build an output log
ftp -n ftp.welchco.com <c:\sd\td\ftpc >c:\sd\td\ftpl
rd c:\sd\wt /s/q
exit

So everything works in XP, but W7 hangs on rd command with "Access denied."

This op is launched from within SDS, an app based on e.exe. When the app is closed, then the rd command seems to execute.

Any suggestions to get rd to run in w7 like xp. Is there an environment variable that can be set to allow processing to complete.

Thanks.

Rod

ChickenSoup
Posts: 79
Joined: 13 Dec 2010 10:32

Re: remove directory W7 batch getting Access denied

#2 Post by ChickenSoup » 13 Dec 2010 13:30

Have you checked the NTFS permissions for the folder and verified that you can delete it without any UAC prompt?

Rod
Posts: 5
Joined: 13 Dec 2010 12:33

Re: remove directory W7 batch getting Access denied

#3 Post by Rod » 13 Dec 2010 14:09

ChickenSoup wrote:Have you checked the NTFS permissions for the folder and verified that you can delete it without any UAC prompt?


Hi,

Spent a week working with W7 "permissions" to set global policies that permit access to all files and directories. Think they are set, but don't know for sure.

c:sd\wt is a temporary directory constructed only when needed to temporarily hold path structure and files for transfer to the web. When the batch op runs, the files and path structure are uploaded, and then it is intended to delete the path and files, for the next pass. I can delete the path and files if I close SDS (where the op was launched), but that defeats the purpose of interactive work. Hoping their is an environment setting or something that enables w7 to run like xp, so daily work is fast and smooth.

Thanks.

Rod

ChickenSoup
Posts: 79
Joined: 13 Dec 2010 10:32

Re: remove directory W7 batch getting Access denied

#4 Post by ChickenSoup » 13 Dec 2010 15:05

Not sure what SDC is but, it sounds like it is having trouble letting go of the directories. So, its not really a batch file issue but a compatibility issue with the program and Windows 7. Have you gone to the properties of the EXE and BAT files and told them to run in Compatibility mode for Windows XP.

Rod
Posts: 5
Joined: 13 Dec 2010 12:33

Re: remove directory W7 batch getting Access denied

#5 Post by Rod » 13 Dec 2010 18:12

Thanks for the tip on setting compatibility mode.

SDS is a macro application for an editor e.exe 16-bit assembler. For past 2 years we have been building a Java version for new platforms. Probably have another year of debugging before we can switch over, so need to run existnig e.exe on w7, as we have for xp.

Tried setting compatiblity to xp sp3; that failed. Tried w95 and that failed.

e.exe through the macro process calls a memory session with start command that launches e.exe again to apply html to a text file for display in a browser, and then writes the file to the disk with a command "savx" that creates a directory structure. The codes executs a quit command to cycle out of start memory and back to the batch op, which uploads all of the files to the web with directory structure so that all of the links are effective. For fun, here is an example...

http://www.welchco.com/sd/08/00101/02/0 ... 140051.HTM

Base directory for temporary storage pending ftp transfer is...

c:\sd\wt

c:\sd always exists; wt is the root level of temporary storage for this op, and so is created as needed, and then deleted each pass to start clean.

Properties for wt says...

Group or user names...

Creator owner
System
Administrators (c17\Administrators)............c17 is the name of the computer

Permissions for Creator Owner

Full Control
Modify
Read & execute
.....

All permissions, however, are blank. This seems to be the problem. Set security in properties for c:\ to give everyone "full control," however, c:\sd does not show this. Manually made "everyone" have "full control" for c:\sd\

Ran the op to create...

c:\sd\wt...

Properties shows everyone has "full control."

Deleting c:\sd\wt still fails wtih message... You need permission from administrator to make these changes."

Randomly checking the directory structure, it shows every level has the same security permissions - everyone full control.

Could this be a W7 error?

Thanks

Rod

ChickenSoup
Posts: 79
Joined: 13 Dec 2010 10:32

Re: remove directory W7 batch getting Access denied

#6 Post by ChickenSoup » 13 Dec 2010 22:01

Do you get the error
You need permission from administrator to make these changes
when you delete via explorer or command line (or both)?

Have tried turning UAC all the way off?

Rod
Posts: 5
Joined: 13 Dec 2010 12:33

Re: remove directory W7 batch getting Access denied

#7 Post by Rod » 13 Dec 2010 23:45

That is the system error when deleting c:\sd\wt\ directory from explorer, or using rd from the command prompt, until the SDS/DOS app is closed.

Please clarify turning "UAC" off?

Thanks.

Rod

ChickenSoup
Posts: 79
Joined: 13 Dec 2010 10:32

Re: remove directory W7 batch getting Access denied

#8 Post by ChickenSoup » 14 Dec 2010 13:17

UAC or User Account Control is part of the new security model for win7.

In the Control Panel, click on "User Accounts".
Click "Change User Account Control Settings".
Move the slider to "Never Notify".
Click Ok and Reboot.

Try again.
Note: it is not recommended to turn UAC all the way off. However, I have heard that some legacy applications require this.

One other thing, did you try to right click your application and have it "Run as Administrator"?

Rod
Posts: 5
Joined: 13 Dec 2010 12:33

Re: remove directory W7 batch getting Access denied

#9 Post by Rod » 14 Dec 2010 18:41

I set UAC to off, and set SDS app to "Run as Adminstrator," as shown on 101204...

http://www.welchco.com/sd/08/00101/02/1 ... 2.HTM#HF6G

Thanks very much for working on this issue. Was hoping to transform to w7 32-bit this year while finalizing SDS 64-bit op toward using w7 64-bit, but it looks like the gods are against us. The problem to solve is strikng a balance between total security, which some situations require, and optimizing productivity where less security is needed.

May wind up using xp this year, but at the moment need a video driver for the new machine to run xp.

Rod

Post Reply