Batch - Pushd & executing script?

May 20, 2009 at 07:11:21
Specs: Windows Vista
hello; i'm having a bit of an issue executing a script on a mapped drive; after using PUSHD; can someone please take a look.

declare @CMDSQL varchar(4000)
declare @ScriptDrive varchar(4000)
declare @ScriptLocation varchar(4000)
declare @ScriptName varchar(4000)

set @ScriptLocation = '\\MappedDrive\Database\'
set @ScriptDrive = 'D:'
set @ScriptName = 'cleanupJob.vbs'
set @CMDSQL = 'pushd ' + @ScriptLocation + ' & ' + 'cscript ' + @ScriptLocation + @Scriptname
print @CMDSQL

EXEC master..xp_CMDShell @CMDSQL





See More: Batch - Pushd & executing script?

Report •


#1
May 20, 2009 at 10:59:44
try adding "cmd /c" to the execute method

correct the below syntax since i don't know the language syntax:
EXEC master..xp_CMDShell 'cmd/c "' + @CMDSQL + '"'


Report •
Related Solutions


Ask Question