• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 485
  • Last Modified:

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
0
boshenska
Asked:
boshenska
5 Solutions
 
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

0
 
Steve KnightIT ConsultancyCommented:
also being win7 you may need to "run as administrator" as otherwise it will only run as your user token.
0
 
Lee W, MVPTechnology and Business Process AdvisorCommented:
and the path quoting is required in ALL versions of Windows, not just Win7.
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Bill PrewCommented:
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
0
 
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
0
 
Steve KnightIT ConsultancyCommented:
Sorry Bill, crossed posts there.  Similar idea but thought best add the regedit /s to silence the Y/N
0
 
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.
0
 
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
0
 
LeeTutorretiredCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now