Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Problem accessing folders from command line

13 Jan 2012   #1
Sedgrick

Windows 7 x64
 
 
Problem accessing folders from command line

I'm trying to use Winzip to back up the My Documents folder onto another drive. Win7 keeps saying it cannot find the path specified. Here are my command line options being run from a batch file:


PATH=%PATH%;C:\_Bin (wzzip.exe is stored here)

c:
cd\users
takeown /f George
icacls George
"cd\Users\George\My Documents"

This is where I get the path error message. What am I doing wrong?


My System SpecsSystem Spec
.
13 Jan 2012   #2
Lemur

Systems 1 and 2: Windows 7 Enterprise x64, Win 8 Developer
 
 

Try setting the path here:

How to set the windows path in Windows 7
My System SpecsSystem Spec
13 Jan 2012   #3
Sedgrick

Windows 7 x64
 
 
Problem Solved

Lemur,

OK what I had to do is right-click on my own My Documents folder and select "Properties, Security" then give myself full permissions of all subfolders. Once I did that I was able to change into those directories from anywhere or include those directories in a path for Winzip.

Also it seems like Win7 while in the Command Environment doesn't recognize the folder My Documents but rather refers to it as Documents even though it displays as My Documents in the Windows Explorer.

I spent the whole day trying to get this to work. Why on earth Microsoft took a simple thing and made it a head ache is beyond me. Thanks for replying to my thread.
My System SpecsSystem Spec
.

13 Jan 2012   #4
Sedgrick

Windows 7 x64
 
 

Forgot to add the contents of my batch file for those who might find it useful:

:set the path to wzzip.exe
path=c:\_bin

:change to folder I want to archive
cd\users\george\documents

:command to archive all files & folders in My Documents
wzzip -i -r -P E:\george\Docs.zip *.*


BTW Lemur, I was able to set paths from within the batch file instead of modifying the system variable.
My System SpecsSystem Spec
13 Jan 2012   #5
Lemur

Systems 1 and 2: Windows 7 Enterprise x64, Win 8 Developer
 
 

What about a different test? Also, put a space after "cd"

Code:
:set the path to wzzip.exe
path=c:\_bin
 
:change to folder I want to archive
cd \users\george\documents
 
:command to archive all files & folders in My Documents
dir *.* > test.txt
Just to see if we are making it to that directory
My System SpecsSystem Spec
14 Jan 2012   #6
Sedgrick

Windows 7 x64
 
 

Yep, I'm making it to "users\george\documents" now but I had to go into "Properties, Security" and take ownership of the Documents folder first, otherwise Win7 wouldn't let me go into that folder. It appears that by default Win7 takes ownership of folders when you are working in the command environment, that's what happened in my case anyway. I later took ownership of the entire C: drive because Win7 wouldn't let me CD into other folders either.

Thanks for your help with this Lemur, it's much appreciated.
My System SpecsSystem Spec
14 Jan 2012   #7
Lemur

Systems 1 and 2: Windows 7 Enterprise x64, Win 8 Developer
 
 

Quote   Quote: Originally Posted by Sedgrick View Post
Yep, I'm making it to "users\george\documents" now but I had to go into "Properties, Security" and take ownership of the Documents folder first, otherwise Win7 wouldn't let me go into that folder. It appears that by default Win7 takes ownership of folders when you are working in the command environment, that's what happened in my case anyway. I later took ownership of the entire C: drive because Win7 wouldn't let me CD into other folders either.

Thanks for your help with this Lemur, it's much appreciated.
Glad it's resolved!
My System SpecsSystem Spec
Reply

 Problem accessing folders from command line




Thread Tools




Similar help and support threads
Thread Forum
Command line - Some questions
I've created a batch file for zipping selected items in a folder. (The file is placed in 'Send to'). If I use the following code: for %%* in (.) do set CurrentFolder=%%~n* "C:\Program Files\WinRar\WinRar" a -afzip "%CurrentFolder%.xpi" The file name is that of the current folder...
General Discussion
Command Line - Help
Hi Guy's and Girls, Just first off I've never been too good with CMD and only an Apprentice in my company I work for. Now something I've wanted to do for awhile was to make the following but I don't necassirealy I know how to do this in one batch file: I would need a Batch file that is...
General Discussion
add folders in indexing options using registry or command line?
Hello, I'm trying to add folders in the indexing options by using either registry or command lines. This is for an unattended silent install. Any ideas ? Thanks.
Performance & Maintenance
How can I set this via command-line or registry?
How can I set this via command-line or registry? I need a way to automatically launch "Explorer c:\folder\myfolder" with a view appropriate for long filenames on any Windows Vista/Win7 PC.
Customization
"there was a problem sending a command line to program"
when i try to open my yahoo messenger account or a html doc. i get this pop up message: "there was a problem sending a command line to program". any suggestions? thanks
General Discussion
Command Line
Is there a cmd.exe /switch for “run as administrator” ? Thanks-
General Discussion


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd

All times are GMT -5. The time now is 16:21.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App