Click here to Skip to main content
15,916,463 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
Hello

I am having batch file xyz.bat containing these commands
copy msvcrtd.dll c:\\
copy MSFLXGRID.OCX c:\\
copy ActiveBrowse.ocx c:\\
regsvr32 c:\\MSFLXGRID.OCX
regsvr32 c:\\ActiveBrowse.ocx

this batch file works fine in xp but i am facing problems
1. whenever i run batch file, error "Access is denied" for all files, activex controls are not registered.
2. whenever i run batch file with "run as" administrator privelege, file is not found error is shown at command prompt.



can anybody solve my problem
Posted
Comments
Albert Holguin 6-Aug-14 15:10pm    
Perhaps you should let us know what you're trying to accomplish by moving these system files around. It's very obvious to me what your problems are with this batch file (permissions plus paths) but I'm not sure why you're even doing this at all. Perhaps if you share what you're trying to accomplish you can get recommendations on how to accomplish your goal in a cleaner manner.

You need to run it "As Administrator". Just having an administrator's privileges is not enough, you also should run it with "elevated privileges". This is how:
http://www.sevenforums.com/tutorials/11841-run-administrator.html[^].

This is related not just to the batch, but to all applications and everything you do which may require privilege elevation. Please see:
http://en.wikipedia.org/wiki/User_Account_Control[^].

In fact, you simply should not do such thing with the root directory of a system disk (if "C:" is your system disk, which may be not the case). This is not a legal directory for putting your application stuff. What is legal directory, depends on your goal. Refer to system documentation. Anyway, if you need to create some directory which would not need UAC confirmation, create some directory and perform required administration of its properties, under "Security" tab. But this administration will itself require elevation of the privileges, of course.

Another option is to switch UAC off, but I would strongly discourage doing so.

[EDIT]

And you got "file is not found" simply because it's not found. Do you really understand path names and command syntax? Just check it up.

—SA
 
Share this answer
 
v3
Comments
Ron Beyer 20-Jul-13 0:37am    
+5'd
Sergey Alexandrovich Kryukov 20-Jul-13 0:37am    
Thank you, Ron.
—SA
As for the file not found error, this is probably due to the fact that Windows 7 does not have the same files as Windows XP (surprise!) , or at least may have moved some of them to different places. I checked on my W7 system and found:

- msvcrtd.dll is not on my system at all, but msvcrt.dll can be found in 15 different locations, with most of them different from each other
- msflxgrd.ocx is located in the directory C:\Windows\SysWOW64\ . Note, this is not one of the directories containing msvcrt.dll
- ActiveBrowse.ocx is not on my system at all!

Whatever you tried to accomplish, you better read up on what system files you need in Windows 7, and while you're at it, read up on how to properly invoke them - copying system files is generally not a good idea. They are where they are for a reason.
 
Share this answer
 
v2
Actully, I was facing the same problem, I was using a .BAT file on that code written like that
// IN XP
cd\
cd Program Files
cd ipmsg
ipmsg.exe /MSG 172.16.11.100 Abc Message...

You need to change the path of the targeted file,
you may see the correct path for the file by right click and see the property,
here you will the right path, accordingly you changed the path, it must work.

I changed the path accordingly
// IN WINDOWS 7
cd\
cd Program Files (x86)
cd ipmsg
ipmsg.exe /MSG 172.16.11.100 Abc Message...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900