Copying files from XP to Vista in a bach file or command prompt - windows-vista

I am trying to setup a batch file to copy files from my XP laptop
to my Vista desktop on a workgroup network.
But I am getting a Access denied error. Same in a command prompt.
I can copy the files fine using Windows Explorer.
Any ideas please?
Malcolm

I'm assuming you've setup a share on Vista that you are accessing in XP.
In Vista, make the share accessible to everyone anonymously:
Right-click the folder you're sharing, and click Properties.
Click the Sharing tab, then Advanced Sharing
Click Permissions.
Click Add.
Under "Enter the object names to select", type "Everyone" (without quotes).
Click OK.
Select Everyone in the "Group or user names" box.
Under "Permissions for Everyone", check the Allow box for Full Control.
Click OK three times.
You should probably map that share as a network drive on your XP computer.
That should work.
EDIT: I have tested this with the exact same conditions you described, and it worked.

Related

Can't edit the host file

I've been trying to edit my host file for a while now and I keep failing.
I tried to open notepad as administrator and then click File --> Open and choosing the host file but I get this error message:
hosts
You don't have permission to open this file.
Contact the file owner or an administrator to obtain permission.
I tried notepad++ as well (as administrator) but I couldn't even get to the file with it (it doesn't show the etc folder in drivers).
I also tried to check my "User Account Control Settings" but it was already on the lowest level (never notify).
While looking online for a solution I've noticed more people having the same problem but I couldn't find a solution that worked for me.
I'm running Windows 7 Home Premium 64-bit
You have to run notepad++ (or your favorite text editor) as an administrator. Right click notepad++ and it should display an option to run it as admin. Once open, locate the hosts file and open it with notepad++.
Windows hosts file location: c:\windows\system32\drivers\etc
Note: copy and paste the above url in the file-explorer when opening a file within notepad++ instead of locating it manually as some directories are hidden.
If the above doesn't work, Windows 10, 8 sometimes requires you to first turn off your antivirus.
If you require editing the hosts file often, you could look into third-party freeware tools to aid you. [1][2]
This works:
For Windows 7 and Windows Vista
Click Start -> All Programs -> Accessories.
Right click on Notepad and select Run as administrator.
Click Continue on the "Windows needs your permission" UAC window.
When Notepad opens Click File -> Open.
In the filename field type the file location, i.e.:
C:\Windows\System32\Drivers\etc\hosts
Click Open.
Make the necessary changes to the hosts file.
Click File -> Save to save your changes.
In my case I could open the file (and Notepad++ was running as admin) however I could not edit it: I could neither type some text, nor delete anything - no popups, no warnings - it looked like keyboard is not working.
I copied the hosts file in the same location, deleted the original hosts file and renamed the new one to hosts. After that I was able to edit the file. I am guessing this should be some permission issue.
OS - windows 7
But first of all you have to do temporally disable your virus guard.
Dissable your antivirus and open notepad.exe with run as administrator edit your host file and save this.
'Run as admin' not enough in windows 8. Set 'modify' access also not enough if you have antivirus
So you need
1) Disable antivirus
2) Set 'modify' access for all applications
3) Modify 'hosts' file
4) Revert 1-2 steps
OK I got it! I had to right click the file, go to Properties, Security tab and click Edit.
Then I took ownership for the file and I had the ability to edit the file's permissions.
On windows 8 running notepad as administrator wasn't enough for me to edit this file. When I tried to open the file from within an administrator session of notepad the etc directory was empty. I changing explorer to show hidden files and extensions, but that only helped in explorer. To edit this with notepad I needed to modify the security settings on the file so that all users and all applications could write to the file. After I finished my changes I set the file back to read only and execute for all applications and users.
there are two notepad.exe in x64 windows,
you must use full path c:\windows\system2\notepad.exe ,this one is 64 bit version,
only type notepad whithout path may be launch 32 bit notepad.
(c:\windows\syswow64\notepad.exe)
"Run as administrator" just let you enforce launch 64 bit notepad.exe
using 32 bit software to edit c:\windows\system32\drivers\etc\hosts
the x64 system will automatic redirect to c:\windows\syswow64\drivers\etc
and there is no hosts file.
the GUI stiil display current folder is c:\windows\system32
but the real folder is c:\windows\syswow64
I had the same problem. After opening the notepad as an Administrator and editing hosts file, I could not save it (denied access). I could not even change file's permissions. What worked for me was copying the file elsewhere, editing there, and then overwriting the original through Command Prompt opened as Administrator. I didn't have to turn off antivirus program.
To open the Command Prompt as administrator, press windows+X and select that option from the menu.
Than, type: mv path-to-the-copy-of-hosts-file\hosts c:\windows\system32\drivers\etc\hosts
I just needed to uncheck "read only" property to allow modify that file.

Disable all shared folder

What is the CMD Command to Disable the All share folder on the Win XP machines.
Thank You
Deliver command in this sequence
net share
This will enlist all the shared resources
net share DataShare /delete
where datashare is the choice you want to remove
http://technet.microsoft.com/en-us/library/bb490712.aspx
(For Win10)
1- Run cmd.exe as administrator
2- wmic path Win32_Share delete
Try the next steps:
Click Start, then right-click Computer, and then click Manage.
In the console tree, click System Tools, then click Shared Folders, and then click Shares.
In the details pane, right-click a shared folder, and then click Stop Sharing (this item only appears if you launched Computer Management using an account that is a member of the local Administrators group).
To stop sharing multiple files, press the CTRL key while clicking the file names, right-click any one of the selected files, and then click Stop Sharing. This removes shared network access to the selected files.
https://technet.microsoft.com/en-us/library/cc753475(v=ws.11).aspx
wmic path Win32_Share delete
(tested on win10)
Not sure about the cmd command and if you want to automate it.
But if it's a 1 time thing you need to do you can always run mmc.exe and add the Shared Folders snapin via File/Add Remove snap-in.
In this screen you will get a list of all your shares and you can disable them as needed.

VB6 Application on Windows 7 Cannot Access Mapped Drives

I have a VB6 application which links to several POS terminals from a Windows 7 32-bit machine. The POS terminals are mapped to the Windows 7 machine and I can access the POS terminals from the Windows 7 machine from Explorer or via the cmdline/shell.
The application has been updated to ADO 2.8 and all other controls and components I no longer had source code for have been re-written. After a few annoying hiccups, I got the application to recompile on the Windows 7 computer without errors.
Now come the problems. The VB6 application cannot see or navigate to any mapped drives! I have tried twiddling UAC settings; I have set the app to run in Windows XP SP3 mode; I have tried running as Administrator. None of these things (and many permutations of these) work.
Any suggestions on how to make this work?
Adding this registry setting solved the problem for me: http://technet.microsoft.com/en-us/library/ee844140%28v=ws.10%29.aspx.
To work around this problem, configure the EnableLinkedConnections
registry value. This value enables Windows Vista and Windows 7 to
share network connections between the filtered access token and the
full administrator access token for a member of the Administrators
group. After you configure this registry value, LSA checks whether
there is another access token that is associated with the current user
session if a network resource is mapped to an access token. If LSA
determines that there is a linked access token, it adds the network
share to the linked location. To configure the EnableLinkedConnections
registry value
Click Start, type regedit in the Start programs and files box, and
then press ENTER.
Locate and then right-click the registry subkey HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System.
Point to New, and then click DWORD Value.
Type EnableLinkedConnections, and then press ENTER.
Right-click EnableLinkedConnections, and then click Modify.
In the Value data box, type 1, and then click OK.
Exit Registry Editor, and then restart the computer.
I believe you are having trouble because casual drive mapping is per-user, and on a UAC system Administrators group users have two separate contexts (one for each token: SU & elevated).
There is such a thing as a system level drive mapping, which is one done under the System user (NT Authority\System). When you map a drive under this account, and map it persistently, all users can see and use the mapping (subject to the usual access rights for files there).
The normal way you do this is via Domain-level GPOs (Group Policy Objects), which means bribing your local box jockeys if in a corporate managed LAN environment.
One way to do this in a Workgroup machine is to map the letter as System via the AT command, from an elevated command prompt:
at 8:53 am "net use m: \\MediaShare\MyLibrary
ThePW /user:MediaShare\TheUser /persistent:yes > nul"
There the remote server is MediaShare, user TheUser, password ThePW, and 8:53 AM is a minute or two in the future to avoid accidentally scheduling this for tomorrow.
But this fails on Vista and later due to Session 0 Isolation!
So... use the 3rd alternative at Run CMD.exe as Local System Account which is the same thing mentioned by ForcePush's reply to How to map a network drive to be used by a service.
I believe that's what you are after here.
don't know if you ever figured this one out but for me it was the ChDir command (even with the registry fix above).
I had in my code
ChDir "P:\Temp\VidCap\Cam1\" 'I almost never use ChDir
Open "list.txt" For Output As #1
and all the VB6 inbuilt file commands looked straight though any operations, no errors, no nothing. I solved it by explicitly having the path, (in my code it was in a string but you could have it explicitly):
dd = "P:\Temp\VidCap\Cam1\"
Open dd & "list.txt" For Output As #1
works as expected.
hope this helps
H
Try this:
Open command prompt as administrator, and type this in:
net use Z: \\IP Address\share /user:you passwd /persistent:Yes
Change "IP Address", the "share" name, and your username and password as needed.
The author of this is howtogeek (source).
I had same problem. VB6 kept crashing when trying to access USB and mapped drives using the Commondialog method, even though the drives and files were all accessible OK via Explorer. Problem is the drives were not set as shared.
Solved by selecting the connected USB drive in explorer and then right click to
select Properties.
Select Sharing Tab
Select Advanced Sharing
Set the sharing and user rights as needed. May need to have local admin rights.

Windows 7 - Can't update my program's files in C:\Program Files

I have an addin program that works with MS Word (version 2007). It is located in the C:\Program Files location. I installed Windows 7 and then went to make a routine change to my files in this location and it would only bring up a read only file. How can I grant myself permission to write to my own program? I cannot change this location or use any other workaround. I have this product out to 25 different companies and I can't change the programming to work from any other location. Thanks
You could also embed a manifest in your EXE that makes your program require adminrights on Windows 7 / Vista.
On Windows Vista, UAC means that users run without admin rights and don't have write access to the program files directories.
The correct solution is to write to a folder for which standard users do have write permissions.
The solution you are looking for is to make your app's folder within program files writeable to all users. You can do this by adding a DACL when installing. It is extremely bad practice to allow standard users to write inside the program files directory and I urge you instead to re-code your app so that it does not need to write there.
Assuming you're doing this as part of modifying the config (and not when your application is running for regular users)...
Your user account probably doesn't have the correct permissions to write/modify the file. Assuming your account is an administrator account, right-click the file, select "Properties". Click the "Security" tab. Click edit and give your user account Full Control.
If you can't do this, it's probably because the ownership of the file doesn't allow you. If this is the case, click on "Advanced", go to the "Owner" tab, and click "Edit".
However, if it needs these permissions when it's running, you should instead be using the %AppData% folder.

open file dialog not working in vista and 2008 envir

i am using Vista . I designed MSi file through Visual Studio 2008 Setup and deployment project in which I added one custom action. In the custom action, I am opening OpenFile dialog. This Open File dialog is not showing mapped drive or network locations. so how can i make the open file dialog to mapthe network drives.
This is a known problem with Vista User Account Control. When your installation program is started, the non-admin session of the user is elevated to an admin session. The problem is: Network drives mapped in the non-admin session of the user do not automatically carry over to the admin session.
Unfortunately, there is not much you can do about it. (You can start an elevated command prompt prior to starting your setup project and manually net use the drive letters there, but I guess that's not something you can expect your customers to do.)
Related question: Preserve mapped drive letter information during UAC elevation

Resources