Usuário com melhor resposta
Verificar se existe arquivo

Pergunta
-
Olá a todos estou com um script e gostaria que voces me ajudassem. Gostaria que ele verificasse se existe um diretorio caso sim ele execute um arquivo, caso contrario ele executa outro comando. Segue um exemplo feito em bat mas não funciona muito bem, se for feito em vbs agradeceria.
REM VERIFICA SE DIRETORIO EXISTE
if not exist "c:\Cacic\" (
REM SE NAO EXISTE, CRIA
mkdir "c:\Cacic"
REM BAIXA ARQUIVOS POR FTP
@ftp -d -i -n -s:\\SERVIDOR\NETLOGON\ftp.txt ftp.dominio.com.brREM EXECUTA INSTALACAO
"c:\Cacic\chkcacic.exe"
)
REM CASO EXISTA"C:\Cacic\cacic2.exe
Esse script eu rodo no meu logon de usuario como System.
ps: A ultima linha eu coloquei agora só para ilustrar.
Respostas
-
Fabio segue script que você quer nos moldes do que você passou
set FSO = createobject("scripting.filesystemobject")
set shell = createobject("wscript.shell")
if fso.folderexists("C:\Cacic\") = false then
set objfolder = fso.createfolder("C:\Cacic\")
shell.run "ftp -d -i -n -s:\\SERVIDOR\NETLOGON\ftp.txt ftp.dominio.com.br", 0,true
shell.run "C:\Cacic\chkcacic.exe"
else
shell.run "C:\Cacic\cacic2.exe"
enf if
Todas as Respostas
-
Fabio segue script que você quer nos moldes do que você passou
set FSO = createobject("scripting.filesystemobject")
set shell = createobject("wscript.shell")
if fso.folderexists("C:\Cacic\") = false then
set objfolder = fso.createfolder("C:\Cacic\")
shell.run "ftp -d -i -n -s:\\SERVIDOR\NETLOGON\ftp.txt ftp.dominio.com.br", 0,true
shell.run "C:\Cacic\chkcacic.exe"
else
shell.run "C:\Cacic\cacic2.exe"
enf if
-
-
-