1.

Solve : Using short filename to change directory?

Answer»

Hello to everyone,
                             I work for a small, but always busy, computer repair shop.  I've been into writing batch files to automate things for years.  I'm in the process of writing a batch file that automates the 'manual system restore' process by allowing you to just enter the drive letter that you're dealing with, the user account name, the restore point that you want and the program will do all of the copying, moving, renaming etc...  The problem I'm having is that I can enter the following from the C:\> "CD System~1", and it will put me in the "System Volume Information" directory, but upon entering the exact same command from the 2nd hard drive E:\> prompt, I get, "The system cannot find the path specified".  I can type  CD "System Volume Information", and it will work that way, but the next directory that I need to go into without having to type the full name because it's VERY long, is the "_restore{LooooooooooooooooooDirectoryName.....................} directory.  This directory name is different inside the brackets from one computer to the next so it can't be used in the program as a constant.  Again, from the C:\System~1> directory, I can enter "CD _resto~1", and be in the C:\System~1\_resto~1> directory, but the same doesn't apply from the E:\> prompt, and I just keep getting, "The system cannot find the specified path".  I'm running XP Pro on a Dell Dimension 4550, and the 2nd hard drive, Drive E: has XP pro on it as well.  I've gone into the 'Sharing and security'  and made the directories that I'm dealing with accessible.  I just don't understand what what works on C:\> doesn't work on E:\>...Thanks, in advance, for any attempt at resolving this, and have a good one,

Michael I'm having a hard time wrapping my single LIVING brain cell around your request.

Quote

The problem I'm having is that I can enter the following from the C:\> "CD System~1", and it will put me in the "System Volume Information" directory, but upon entering the exact same command from the 2nd hard drive E:\> prompt, I get, "The system cannot find the path specified".  I can type  CD "System Volume Information", and it will work that way

Normally, the system and hidden attribute bits are turned on for the System Volume Information directory. If I try your command I get "access denied" I'm not sure mucking around in this directory is a good thing and in any case I doubt there is anything batch code can do with the files/data in the directory.

Quote
I'm in the process of writing a batch file that automates the 'manual system restore' process by allowing you to just enter the drive letter that you're dealing with, the user account name, the restore point that you want

Restore points are numbered. You can restore a system by referencing that number. System restore will restore all the drives/partitions that are currently being monitored. As far as I know you cannot pick and choose drive letters, it's either all or nothing. For that you would need a backup/restore application such as NTBackup (installed with XP Pro; install from XP CD on XP Home)

You can check out these VBScripts. You will need the "Viewing All Existing Restore Points" script to get the number of the restore point, and the "Conducting a System Restore" script for actually doing a restore.

Truthfully I can't see much improvement over the Microsoft System Restore GUI. Seems like you're reinventing the wheel.

Good luck.  Thanks, Sidewinder, for taking the time to respond.  I do appreciate it  .  I'm not, however, TRYING to reinvent anything.  If you were to google "Manual System

Restore" you'd probably see in there somewhere what I'm trying to write a batch-file for.  The process is as follows: 

1) Connect the drive that you need to manually restore to a computer as a 2nd hard drive (I've been using a USB hot-swapable cable to connect the drive to the system).


2) Make sure 'Show hidden files and FOLDERS' is selected, and 'Hide extensions for known file types' is unchecked by clicking 'My Computer\Tools\Folder Options\View'

3) Navigate to the following directory of the drive that you've just connected (in this case we'll say it's drive (E:) ) 'E:\WINDOWS\system32\config'

4) Right-click the desktop and select 'New' then 'Folder' and name it 'TMP' or something you'll remember and open the folder.

5) There will be 5 files without any extensions at all.  Just what you see between the single quotes, 'Default', 'Software', 'System', 'SECURITY' and 'SAM'.  Hold down

the CTRL key and click each of these files then right-click one of them and drag them into the new folder that you just made on the desktop and choose 'move'

6) In 'My Computer', Open 'Local Disk (C:) and scroll down to 'System Volume Information', Right-Click and select 'Sharing and Security...', then click 'Security' click 'Add' and enter your user account name in the box and click 'Ok'

7) Check the box next to 'Full Control' and click 'Ok'.  Open 'System Volume Information', and then '_restore{52D47666-AC67-41BB-8E40-C4A9FA6443A1}' (the letter-number combination differs from one drive to the next).

<--(That was supposed to be an '8') Now you get to choose your restore  point (as you pointed out, they're numbered...They're also dated if you enable 'details' from the 'view' drop-down box on the folder menu over the address box).

9) Once you've picked your restore point, there's another folder in here called, 'Snapshot'.  Open the 'Snapshot' folder.

10) Inside the 'Snapshot' folder there are 5 files that begin with, '_REGISTRY_MACHINE_', and end with the same 5 file names as in step 5 (the only difference being that there's a '.' before 'DEFAULT') , so hold down the CTRL key, just as in step 5, and click '_REGISTRY_MACHINE_.DEFAULT', '_REGISTRY_MACHINE_SOFTWARE', '_REGISTRY_MACHINE_SECURITY', '_REGISTRY_MACHINE_SYSTEM' and '_REGISTRY_MACHINE_SAM'.  Right-click one of them and select, 'Copy'.

11) Navigate to 'E:\WINDOWS\system32\config' and right-click and paste the files.  This is the same directory that you moved the files from step 5 out of.

12) Right-click each of the FIVE files and select, 'rename'.  Remove everything from the name except for the very last part of the name before the last underscore ('_'), so '_REGISTRY_MACHINE_.DEFAULT' becomes, 'DEFAULT' , '_REGISTRY_MACHINE_SOFTWARE' becomes, 'SOFTWARE' and so on for the other 3.


And that's it.  You've just manually restored your computer.  This can be useful when some really nasty virus disables your 'System Restore' functionality, and you can't get to the usual way of doing it from the 'Start\Programs\Accessories\System tools\System Restore'   Sure hope this is useful to someone. 

Oh, I almost forgot, A good friend figured out my original dilema.  All you need to do is enter the following...'CD Sy*' will put you into the 'System Volume Information' directory, and then, 'CD _*' will put you into the '_restore{52D47666-AC67-41BB-8E40-C4A9FA6443A1}' directory.Hi All,
         This is a CORRECTION update to my last post.  In step 6, the 'Local Disk (C:)' should have been, 'Local Disk (E:).  I'm sorry for any confusion,

Michael


Discussion

No Comment Found