Jump to content

cmd syntax help needed


MCT

Recommended Posts

i need to get this to work

REM Copying Foobar2000 Config File
REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce /V foobar /d "cmd /c xcopy %cdrom%\Install\Apps\Extras\Foobar2000.cfg "%appdata%\Foobar2000\" /Y " /f

i cant get it to work with

REM Copying Foobar2000 Config File
REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce /V foobar /d "cmd /c xcopy %cdrom%\Install\Apps\Extras\Foobar2000.cfg %appdata%\Foobar2000\" /Y " /f

but %appdata% needs to be in quotes cuz it contains spaces

Edited by MCT
Link to comment
Share on other sites


Perhaps like this:

REM Copying Foobar2000 Config File
REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce /V foobar /d "cmd /c copy /y \"%cdrom%\Install\Apps\Extras\Foobar2000.cfg\" \"%appdata%\Foobar2000\"" /f

else you would need to wrap the whole cmd in another pair of double quotes with backslashes. Your only copying 1 file so just use Copy to do it.

Link to comment
Share on other sites

forgot 2 say thanks MHz :D

i have another question along same lines :P

cant get this 2 work it adds

c:\Program files\ccleaner\ccleaner.exe /auto

but not in quotes

code i have is:

REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce /V ccleaner /d ""%programfiles%\ccleaner\ccleaner.exe" /auto" /f

Link to comment
Share on other sites

This works fine. You do not see it running but it cleans.

REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce /V ccleaner /d "\"%programfiles%\ccleaner\ccleaner.exe\" /auto" /f

General rule:

For each double quote within surrounding double quotes, add a backslash in front of them. ;)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...