Hi,
I have a vbscript that runs an attrib comand to change the readonly
property of a folder as follows

runattribcmd = "attrib -r " + LogsFolder + " /S /D"
dim wsh
Set wsh = CreateObject("WScript.Shell")
wsh.run runattribcmd, 7, false


now my problem is that when this vbscript is run i get a popup command
line window with "Are you sure?" on it and I have click "y" to continue
..
is there a way i can suppress this popup window. i always want to
answer y for the warning .
how do i do this ..
thanks,
mav

Re: supress cmd line warnings from vbscript !! by Jim

Jim
Tue Jun 13 09:43:44 CDT 2006

thry this line:

runattribcmd = "echo y | attrib -r " + LogsFolder + " /S /D"




"maverick1611" <atulpandey@gmail.com> wrote in message
news:1150209069.941377.320410@f6g2000cwb.googlegroups.com...
> Hi,
> I have a vbscript that runs an attrib comand to change the readonly
> property of a folder as follows
>
> runattribcmd = "attrib -r " + LogsFolder + " /S /D"
> dim wsh
> Set wsh = CreateObject("WScript.Shell")
> wsh.run runattribcmd, 7, false
>
>
> now my problem is that when this vbscript is run i get a popup command
> line window with "Are you sure?" on it and I have click "y" to continue
> ..
> is there a way i can suppress this popup window. i always want to
> answer y for the warning .
> how do i do this ..
> thanks,
> mav
>



Re: supress cmd line warnings from vbscript !! by maverick1611

maverick1611
Tue Jun 13 10:13:22 CDT 2006

hey Jim,
i get an error saying "the system could not find the file specified" if
I add "echo y | " to runattribcmd within the vbscript ..
however if i run the "echo y | attrib -r c:\LogsFolder /S /D" command
on command line it works perfectly
any idea why ?
thanks again


Jim wrote:
> thry this line:
>
> runattribcmd = "echo y | attrib -r " + LogsFolder + " /S /D"
>
>
>
>
> "maverick1611" <atulpandey@gmail.com> wrote in message
> news:1150209069.941377.320410@f6g2000cwb.googlegroups.com...
> > Hi,
> > I have a vbscript that runs an attrib comand to change the readonly
> > property of a folder as follows
> >
> > runattribcmd = "attrib -r " + LogsFolder + " /S /D"
> > dim wsh
> > Set wsh = CreateObject("WScript.Shell")
> > wsh.run runattribcmd, 7, false
> >
> >
> > now my problem is that when this vbscript is run i get a popup command
> > line window with "Are you sure?" on it and I have click "y" to continue
> > ..
> > is there a way i can suppress this popup window. i always want to
> > answer y for the warning .
> > how do i do this ..
> > thanks,
> > mav
> >


Re: supress cmd line warnings from vbscript !! by Jim

Jim
Tue Jun 13 13:24:55 CDT 2006

youre not using quotes properly, and stop using "+" to concat strings. try
this:

runattribcmd = "echo y | attrib -r " & LogsFolder & " /S /D"

this assumes that LogsFolder is a variable that contains a valid path



"maverick1611" <atulpandey@gmail.com> wrote in message
news:1150211602.276010.210250@g10g2000cwb.googlegroups.com...
> hey Jim,
> i get an error saying "the system could not find the file specified" if
> I add "echo y | " to runattribcmd within the vbscript ..
> however if i run the "echo y | attrib -r c:\LogsFolder /S /D" command
> on command line it works perfectly
> any idea why ?
> thanks again
>
>
> Jim wrote:
>> thry this line:
>>
>> runattribcmd = "echo y | attrib -r " + LogsFolder + " /S /D"
>>
>>
>>
>>
>> "maverick1611" <atulpandey@gmail.com> wrote in message
>> news:1150209069.941377.320410@f6g2000cwb.googlegroups.com...
>> > Hi,
>> > I have a vbscript that runs an attrib comand to change the readonly
>> > property of a folder as follows
>> >
>> > runattribcmd = "attrib -r " + LogsFolder + " /S /D"
>> > dim wsh
>> > Set wsh = CreateObject("WScript.Shell")
>> > wsh.run runattribcmd, 7, false
>> >
>> >
>> > now my problem is that when this vbscript is run i get a popup command
>> > line window with "Are you sure?" on it and I have click "y" to continue
>> > ..
>> > is there a way i can suppress this popup window. i always want to
>> > answer y for the warning .
>> > how do i do this ..
>> > thanks,
>> > mav
>> >
>



Re: supress cmd line warnings from vbscript !! by ekkehard

ekkehard
Tue Jun 13 14:07:36 CDT 2006

maverick1611 wrote:
> hey Jim,
> i get an error saying "the system could not find the file specified" if
> I add "echo y | " to runattribcmd within the vbscript ..
> however if i run the "echo y | attrib -r c:\LogsFolder /S /D" command
> on command line it works perfectly
> any idea why ?
> thanks again
>
>
You need a shell to use echo (same as for device rerouting, by the
way):

Dim aTests : aTests = Array( _
"echo ThisWontWork" _
, "%comspec% /c echo ThisWillWork" _
)
Dim oShell : Set oShell = WScript.CreateObject( "WScript.Shell" )
Dim sCmd, vRet

For Each sCmd In aTests
WScript.Echo "sCmd: " + sCmd
On Error Resume Next
vRet = oShell.Run( sCmd, SW_SHOWMINNOACTIVE, True )
If 0 <> Err.Number Then
WScript.Echo "ERR: " & Err.Number & " - " & Err.Description
End If
On Error GoTo 0
WScript.Echo "vRet: " & vRet
WScript.Echo "------------------------------"
Next

> Jim wrote:
>
>>thry this line:
>>
>>runattribcmd = "echo y | attrib -r " + LogsFolder + " /S /D"
>>
>>
>>
>>
>>"maverick1611" <atulpandey@gmail.com> wrote in message
>>news:1150209069.941377.320410@f6g2000cwb.googlegroups.com...
>>
>>>Hi,
>>>I have a vbscript that runs an attrib comand to change the readonly
>>>property of a folder as follows
>>>
>>>runattribcmd = "attrib -r " + LogsFolder + " /S /D"
>>>dim wsh
>>>Set wsh = CreateObject("WScript.Shell")
>>>wsh.run runattribcmd, 7, false
>>>
>>>
>>>now my problem is that when this vbscript is run i get a popup command
>>>line window with "Are you sure?" on it and I have click "y" to continue
>>>..
>>>is there a way i can suppress this popup window. i always want to
>>>answer y for the warning .
>>>how do i do this ..
>>>thanks,
>>>mav
>>>
>
>

Re: supress cmd line warnings from vbscript !! by ekkehard

ekkehard
Tue Jun 13 14:15:24 CDT 2006

Sorry, lost the first line of the code

Const SW_SHOWMINNOACTIVE = 7

during copy & paste.