How to make A DOS .bat file work in Windows 7, I wrote a little batch file and it won't run

Here is the batch file I am not sure what I am doing wrong:

cd\

copy  C:\TEMP\Tech Tools\Software, Tools and Utilities\Disable AdobeFlash Updates\mms.cfg  c:\windows\system32\macromed\flash

Pause

C:\TEMP\Tech_Tools\Software, Tools and Utilities\Disable AdobeFlash Updates\disable java AutoUpdateChecking.reg

Pause

C:\TEMP\Tech_Tools\Software, Tools and Utilities\Disable AdobeFlash Updates\disable java update.reg

Pause

C:\TEMP\Tech_Tools\Software, Tools and Utilities\Disable Adobe Reader AutoUpdate.reg

Pause

C:\TEMP\Tech_Tools\Software, Tools and Utilities\Disable Adobe Reader UpdateUI.reg

Pause

"C:\TEMP\Tech_Tools\Software, Tools and Utilities\ccmsetup.exe

EXIT
boshenskaAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Lee W, MVPTechnology and Business Process AdvisorCommented:
You must quote the paths.  Otherwise, it looks like the command is "c:\temp\Tech_Tools\Software," and the parameters for that command are, for example, Tools and Utilities\Disable AdobeFlash Updates\disable java AutoUpdateChecking.reg
cd\

copy  "C:\TEMP\Tech Tools\Software, Tools and Utilities\Disable AdobeFlash Updates\mms.cfg"  "c:\windows\system32\macromed\flash"

Pause

"C:\TEMP\Tech_Tools\Software, Tools and Utilities\Disable AdobeFlash Updates\disable java AutoUpdateChecking.reg"

Pause

"C:\TEMP\Tech_Tools\Software, Tools and Utilities\Disable AdobeFlash Updates\disable java update.reg"

Pause

"C:\TEMP\Tech_Tools\Software, Tools and Utilities\Disable Adobe Reader AutoUpdate.reg"

Pause

"C:\TEMP\Tech_Tools\Software, Tools and Utilities\Disable Adobe Reader UpdateUI.reg"

Pause

"C:\TEMP\Tech_Tools\Software, Tools and Utilities\ccmsetup.exe"

EXIT

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Steve KnightIT ConsultancyCommented:
also being win7 you may need to "run as administrator" as otherwise it will only run as your user token.
Lee W, MVPTechnology and Business Process AdvisorCommented:
and the path quoting is required in ALL versions of Windows, not just Win7.
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

Bill PrewIT / Software Engineering ConsultantCommented:
It can also be useful to use environment variables in the BAT script to save typing and reduce typos, as in:

setlocal
cd\
set ToolsDir=C:\TEMP\Tech Tools\Software, Tools and Utilities
copy "%ToolsDir%\Disable AdobeFlash Updates\mms.cfg" "c:\windows\system32\macromed\flash"
Pause
"%ToolsDir%\Disable AdobeFlash Updates\disable java AutoUpdateChecking.reg"
Pause
"%ToolsDir%\Disable AdobeFlash Updates\disable java update.reg"
Pause
"%ToolsDir%\Disable Adobe Reader AutoUpdate.reg"
Pause
"%ToolsDir%\Disable Adobe Reader UpdateUI.reg"
Pause
"%ToolsDir%\ccmsetup.exe"
EXIT

Open in new window

~bp
Steve KnightIT ConsultancyCommented:
Also surely each is prompting you for an answer "Y" to import?

have you considered using

regedit /s yourregfile.reg

@echo off
set thepath=C:\TEMP\Tech Tools\Software, Tools and Utilities
copy  "%thepath%\Disable AdobeFlash Updates\mms.cfg"  "%systemroot%\system32\macromed\flash"
Pause
regedit /s "%thepath%\Disable AdobeFlash Updates\disable java AutoUpdateChecking.reg"
Pause
regedit /s "%thepath%\Disable AdobeFlash Updates\disable java update.reg
regedit /s "%thepath%\Disable Adobe Reader AutoUpdate.reg
regedit /s "%thepath%\Disable Adobe Reader UpdateUI.reg
Pause
START "" "%thepath%\ccmsetup.exe"
EXIT
Steve KnightIT ConsultancyCommented:
Sorry Bill, crossed posts there.  Similar idea but thought best add the regedit /s to silence the Y/N
BillDLCommented:
Hi boshenka

Why don't you just create one *.REG file containing all your "disable" lines, eg. "Disable_Flash_AdobeReader_Java_Updates.reg" and import that in one go?

I know it's probably just for convenience that you have *.reg files relating to Java and Adobe Flash/Acrobat Reader in one folder named "Disable AdobeFlash Updates", but I would suggest either useing separate sub-folders with appropriate names or else one folder and have useful names for the *.REG files.

For any folders I create that contain "Tools" I never use spaces, and instead use underscores.  Obviously double-quoting takes care of the spaces, but when testing batch files it's too easy to accidentally leave off a quote and mess something up.  I wouldn't choose "C:\TEMP" as a place to store utility programs and batch files either.  Of course you are maybe experimenting with a self-extracting package that unpacks then runs the batch file.  If that is the case, then it would probably be better to specify the logged on user's "Temp" file using the %temp% variable or the "All Users" temp folder.

It's down to all personal choice, but I would normally use folder and file names like this, because I know what "Softw", "Utils", "Upd", "AcroRd", etc all mean and don't feel the need to spell it all out in full with commas and so on:
Tech_Tools\Softw-Tools-Utils\Disable_Auto_Update\Flash_Upd_Off.reg
Tech_Tools\Softw-Tools-Utils\Disable_Auto_Update\AcroRd_Upd_Off.reg
Tech_Tools\Softw-Tools-Utils\Disable_Auto_Update\Java_Upd_Off.reg

Lengthy paths are a nuisance in batch files, and even with Bill Prews good suggestion of using Variables, you still have quite long lines.
Steve KnightIT ConsultancyCommented:
a good point Bill.  I assumed he wanted them separate because they werent always needed etc.

could also use the reg.exe command of course if only, say ione or teo reg key/values need amending in them.

Steve
LeeTutorretiredCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft DOS

From novice to tech pro — start learning today.