Link to home
Start Free TrialLog in
Avatar of Naerwen
Naerwen

asked on

Simple Batch file not working

All,

      My kung-fu with regards to scripting is weak. That said I am pretty sure that the code below should work.

In brief it should go like this:

The batch file creates a directory and then copies files to it using xcopy /E (don't know why, but 'copy' doesn't do it.).  At the end of the batch file I run 'regedit /s source.reg'.

The problem is that the registry changes are not taking place.

In closing, I would like to mention that I have read the following:
https://www.experts-exchange.com/questions/22672135/Change-i386-location-in-registry.html?anchorAnswerId=19408970#a19408970 --> VB Script DOES NOT WORK
http://www.tweakxp.com/article37514.aspx --> I know where/what reg keys need to be altered ... so this is a mute point.

The code and images are attached.

Please help.

Thank you,

Naerwen
===BATCH FILE===
 
REM This batch file will copy the I386 folder to the "C:\I386" folder and enter the proper registry entries
REM to eliminate the need to have a Windows XP Disk when installing/uninstalling Windows components.
 
REM Create destination directory
mkdir C:\I386
 
REM Get I386 to the root of 'C'
xcopy I386 c:\I386 /E
 
REM Next we will merge the necessary registry entries to point to 'C:\I386' 
 
regedit /s source.reg
 
pause
 
 
===source.reg FILE===
 
Windows Registry Editor Version 5.00
 
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup]
"ServicePackSourcePath"="C:\"
"SourcePath"="C:\"

Open in new window

batchfileimages.png
Avatar of ti84p
ti84p
Flag of United States of America image

try removing the /s from the regedit command and see if it returns an error
it is possible that the user doesn't have the necessary permissions
Avatar of Naerwen
Naerwen

ASKER

ti84p,
 
     Thank you for the prompt response. I should have been more thorough when explaining the test environment:
1) Removing the '/s' simply does what it is supposed to do, which is prompt the user to say 'OK' or 'Cancel'.
2) To address your second concern, the test platform is a Dell D630 using the local Administrator account. To take that a step further the only other piece of software installed on the box is Snagit9 and Office 2003.
 
I hope this helps your assessment. I will remain engaged while working this problem.
 
Thank you,
 
Naerwen
ASKER CERTIFIED SOLUTION
Avatar of AmazingTech
AmazingTech

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Does removing /s make it import properly though?
Remove the /s for testing. Once everything looks OK. Put the /s in.

But in your case I don't think you need to be testing anymore.
Avatar of Naerwen

ASKER

AmazingTech,

Perfect. My export of the tree WAS INCORRECT for some reason ... or I may have edited and forgotten.

Thank you,

Naerwen
Always export so you can get the baseline of what it should look like.

I'm glad it works for you now.