Schtasks: Using quotes in arguments

N

noroominhead

Hello All:

I am trying to schedule a backup on Win XP Pro using the following
syntax:

schtasks /create /tn "Incremental Backup" /tr
C:\WINDOWS\system32\ntbackup.exe backup
"@C:\UserProfiles\Administrator\Local Settings\Application
Data\Microsoft\Windows NT\NTBackup\data\Default.bks" /a /d "Set created
1/1/2006 at 4:56 PM" /v:no /r:no /rs:no /hc:blush:ff /m normal /j
"Incremental Backup" /l:s /f "E:\backup\IncrementalBackup.bkf" /sc
WEEKLY /d TUES,WED,THUR,FRI,SAT,SUN /st 12:00:00 /ru "System"

The error I'm getting when executing this is: "Invalid Argument/Option
- 'backup'"

I believe the issue is that I need to encapsulate the portion of the
string containing the ntbackup.exe and associated arguments, but don't
know for sure. I checked MS.com, and found docs here:
http://www.microsoft.com/technet/pr...elp/1d284efa-9d11-46c2-a8ef-87b297c68d17.mspx
but there were no examples. In addition, the docs mentioned a 262 char
limit on path names, although I _think_ that applies to just the path
to the executable, not any associated arguments.

While I'm aware that i may be able to solve this by putting the
executable and args into a batch file, I'm specifically interested on
if this can be accomplished as above, in a single command. TIA.
 
P

Pegasus \(MVP\)

Hello All:

I am trying to schedule a backup on Win XP Pro using the following
syntax:

schtasks /create /tn "Incremental Backup" /tr
C:\WINDOWS\system32\ntbackup.exe backup
"@C:\UserProfiles\Administrator\Local Settings\Application
Data\Microsoft\Windows NT\NTBackup\data\Default.bks" /a /d "Set created
1/1/2006 at 4:56 PM" /v:no /r:no /rs:no /hc:blush:ff /m normal /j
"Incremental Backup" /l:s /f "E:\backup\IncrementalBackup.bkf" /sc
WEEKLY /d TUES,WED,THUR,FRI,SAT,SUN /st 12:00:00 /ru "System"

The error I'm getting when executing this is: "Invalid Argument/Option
- 'backup'"

I believe the issue is that I need to encapsulate the portion of the
string containing the ntbackup.exe and associated arguments, but don't
know for sure. I checked MS.com, and found docs here:
http://www.microsoft.com/technet/pr...elp/1d284efa-9d11-46c2-a8ef-87b297c68d17.mspx
but there were no examples. In addition, the docs mentioned a 262 char
limit on path names, although I _think_ that applies to just the path
to the executable, not any associated arguments.

While I'm aware that i may be able to solve this by putting the
executable and args into a batch file, I'm specifically interested on
if this can be accomplished as above, in a single command. TIA.

I'm intrigued that you post this WinXP question in this group
even though it is clearly a Win2000 group . . .

Your command appears to be correct even though I'm not sure
about some of its switches since they are WinXP-specific. Double
quotes are certainly supported in a scheduled command. An easy
way to resolve the problem is to use the backup wizard. It will
schedule a job with much the same command, thus allowing you
to compare the command lines on an item-by-item basis.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top