Home All Groups Group Topic Archive Search About
Author
28 Apr 2007 3:06 PM
Trying to Learn
Hi,

I was trying to write a simple batch file in Vista, and discovered that I
need to do these tasks in the form of a script.  I have no experience with
scripts.  I felt pretty fortunate that I could get things done using batch
files.  I'm an old DOS guy.  This is the task I need automated .....

del c:\users\public\public~1\cqgnet\temp\*.*
del c:\users\public\public~1\cqgnet\private\bourtov.*

I have tried to no avail to convert this to a script.  Any help would be
deeply appreciated as I would learn a lot if I saw it in script.

Thank you ... Sam

Author
2 May 2007 12:42 PM
CreateWindow
Hi,

Something like this should work.

delstr1 = "cmd /c del c:\users\public\public~1\cqgnet\temp\*.*"
delstr2 = "cmd /c del c:\users\public\public~1\cqgnet\private\bourtov.*"

Set WshShell = WScript.CreateObject("WScript.Shell")
  ExitCode = WshShell.Run(delstr1, 10, TRUE )
  ExitCode = WshShell.Run(delstr2, 10, TRUE )
Set WshShell = Nothing

You can test the ExitCode if you like. I think the above is ok - anyway it
will get you started.

CreateWindow
http://justpageprobe.com
The FREE Web page utility you always wanted.
Keep your router connected.
Email your IP to where you need it.
Monitor your enterprise Web Servers.


Show quoteHide quote
"Trying to Learn" <Trying to Le***@discussions.microsoft.com> wrote in
message news:7CA962B7-EC33-422E-B4FF-E83A84760728@microsoft.com...
> Hi,
>
> I was trying to write a simple batch file in Vista, and discovered that I
> need to do these tasks in the form of a script.  I have no experience with
> scripts.  I felt pretty fortunate that I could get things done using batch
> files.  I'm an old DOS guy.  This is the task I need automated .....
>
> del c:\users\public\public~1\cqgnet\temp\*.*
> del c:\users\public\public~1\cqgnet\private\bourtov.*
>
> I have tried to no avail to convert this to a script.  Any help would be
> deeply appreciated as I would learn a lot if I saw it in script.
>
> Thank you ... Sam
Author
2 May 2007 4:00 PM
Trying to Learn
Thanks for your response.  I am still having a problem, but have a question.

When I typed the path to the files I want to delete I used a sub directory
called public~1.  If I typed the complete name it would have been ... public
documents.  The problem is that I have 4 other sub directories starting with
public.

In Vista I have  .....

Public Documents  (what I need to path to)
Public Downloads
Public Music
Public Pictures
Public Videos

That is why I used public~1  (I tried 2,3,4,5 also with no luck)

Was that right?


Show quoteHide quote
"CreateWindow" wrote:

> Hi,
>
> Something like this should work.
>
> delstr1 = "cmd /c del c:\users\public\public~1\cqgnet\temp\*.*"
> delstr2 = "cmd /c del c:\users\public\public~1\cqgnet\private\bourtov.*"
>
> Set WshShell = WScript.CreateObject("WScript.Shell")
>   ExitCode = WshShell.Run(delstr1, 10, TRUE )
>   ExitCode = WshShell.Run(delstr2, 10, TRUE )
> Set WshShell = Nothing
>
> You can test the ExitCode if you like. I think the above is ok - anyway it
> will get you started.
>
> CreateWindow
> http://justpageprobe.com
> The FREE Web page utility you always wanted.
> Keep your router connected.
> Email your IP to where you need it.
> Monitor your enterprise Web Servers.
>
>
> "Trying to Learn" <Trying to Le***@discussions.microsoft.com> wrote in
> message news:7CA962B7-EC33-422E-B4FF-E83A84760728@microsoft.com...
> > Hi,
> >
> > I was trying to write a simple batch file in Vista, and discovered that I
> > need to do these tasks in the form of a script.  I have no experience with
> > scripts.  I felt pretty fortunate that I could get things done using batch
> > files.  I'm an old DOS guy.  This is the task I need automated .....
> >
> > del c:\users\public\public~1\cqgnet\temp\*.*
> > del c:\users\public\public~1\cqgnet\private\bourtov.*
> >
> > I have tried to no avail to convert this to a script.  Any help would be
> > deeply appreciated as I would learn a lot if I saw it in script.
> >
> > Thank you ... Sam
>
>
>
Author
2 May 2007 11:24 PM
CreateWindow
Hi,

That was probably not right.
What about specifying the full name?

CreateWindow



Show quoteHide quote
"Trying to Learn" <TryingtoLe***@discussions.microsoft.com> wrote in message
news:AE02C341-B21D-41C7-ACBC-DC8BCB3A62E9@microsoft.com...
> Thanks for your response.  I am still having a problem, but have a
> question.
>
> When I typed the path to the files I want to delete I used a sub directory
> called public~1.  If I typed the complete name it would have been ...
> public
> documents.  The problem is that I have 4 other sub directories starting
> with
> public.
>
> In Vista I have  .....
>
> Public Documents  (what I need to path to)
> Public Downloads
> Public Music
> Public Pictures
> Public Videos
>
> That is why I used public~1  (I tried 2,3,4,5 also with no luck)
>
> Was that right?
>
>
> "CreateWindow" wrote:
>
>> Hi,
>>
>> Something like this should work.
>>
>> delstr1 = "cmd /c del c:\users\public\public~1\cqgnet\temp\*.*"
>> delstr2 = "cmd /c del c:\users\public\public~1\cqgnet\private\bourtov.*"
>>
>> Set WshShell = WScript.CreateObject("WScript.Shell")
>>   ExitCode = WshShell.Run(delstr1, 10, TRUE )
>>   ExitCode = WshShell.Run(delstr2, 10, TRUE )
>> Set WshShell = Nothing
>>
>> You can test the ExitCode if you like. I think the above is ok - anyway
>> it
>> will get you started.
>>
>> CreateWindow
>> http://justpageprobe.com
>> The FREE Web page utility you always wanted.
>> Keep your router connected.
>> Email your IP to where you need it.
>> Monitor your enterprise Web Servers.
>>
>>
>> "Trying to Learn" <Trying to Le***@discussions.microsoft.com> wrote in
>> message news:7CA962B7-EC33-422E-B4FF-E83A84760728@microsoft.com...
>> > Hi,
>> >
>> > I was trying to write a simple batch file in Vista, and discovered that
>> > I
>> > need to do these tasks in the form of a script.  I have no experience
>> > with
>> > scripts.  I felt pretty fortunate that I could get things done using
>> > batch
>> > files.  I'm an old DOS guy.  This is the task I need automated .....
>> >
>> > del c:\users\public\public~1\cqgnet\temp\*.*
>> > del c:\users\public\public~1\cqgnet\private\bourtov.*
>> >
>> > I have tried to no avail to convert this to a script.  Any help would
>> > be
>> > deeply appreciated as I would learn a lot if I saw it in script.
>> >
>> > Thank you ... Sam
>>
>>
>>
Author
3 May 2007 1:48 PM
Trying to Learn
Hi again,

Sorry, I tried using the full name but it has a space in it "public
documents".  I don't know how to get around it.

Thanks again ... Sam

Show quoteHide quote
"CreateWindow" wrote:

> Hi,
>
> That was probably not right.
> What about specifying the full name?
>
> CreateWindow
>
>
>
> "Trying to Learn" <TryingtoLe***@discussions.microsoft.com> wrote in message
> news:AE02C341-B21D-41C7-ACBC-DC8BCB3A62E9@microsoft.com...
> > Thanks for your response.  I am still having a problem, but have a
> > question.
> >
> > When I typed the path to the files I want to delete I used a sub directory
> > called public~1.  If I typed the complete name it would have been ...
> > public
> > documents.  The problem is that I have 4 other sub directories starting
> > with
> > public.
> >
> > In Vista I have  .....
> >
> > Public Documents  (what I need to path to)
> > Public Downloads
> > Public Music
> > Public Pictures
> > Public Videos
> >
> > That is why I used public~1  (I tried 2,3,4,5 also with no luck)
> >
> > Was that right?
> >
> >
> > "CreateWindow" wrote:
> >
> >> Hi,
> >>
> >> Something like this should work.
> >>
> >> delstr1 = "cmd /c del c:\users\public\public~1\cqgnet\temp\*.*"
> >> delstr2 = "cmd /c del c:\users\public\public~1\cqgnet\private\bourtov.*"
> >>
> >> Set WshShell = WScript.CreateObject("WScript.Shell")
> >>   ExitCode = WshShell.Run(delstr1, 10, TRUE )
> >>   ExitCode = WshShell.Run(delstr2, 10, TRUE )
> >> Set WshShell = Nothing
> >>
> >> You can test the ExitCode if you like. I think the above is ok - anyway
> >> it
> >> will get you started.
> >>
> >> CreateWindow
> >> http://justpageprobe.com
> >> The FREE Web page utility you always wanted.
> >> Keep your router connected.
> >> Email your IP to where you need it.
> >> Monitor your enterprise Web Servers.
> >>
> >>
> >> "Trying to Learn" <Trying to Le***@discussions.microsoft.com> wrote in
> >> message news:7CA962B7-EC33-422E-B4FF-E83A84760728@microsoft.com...
> >> > Hi,
> >> >
> >> > I was trying to write a simple batch file in Vista, and discovered that
> >> > I
> >> > need to do these tasks in the form of a script.  I have no experience
> >> > with
> >> > scripts.  I felt pretty fortunate that I could get things done using
> >> > batch
> >> > files.  I'm an old DOS guy.  This is the task I need automated .....
> >> >
> >> > del c:\users\public\public~1\cqgnet\temp\*.*
> >> > del c:\users\public\public~1\cqgnet\private\bourtov.*
> >> >
> >> > I have tried to no avail to convert this to a script.  Any help would
> >> > be
> >> > deeply appreciated as I would learn a lot if I saw it in script.
> >> >
> >> > Thank you ... Sam
> >>
> >>
> >>
>
>
>
Author
4 May 2007 1:23 AM
CreateWindow
Ok,

Yes, that can be tricky using cmd /c etc.  An easy way out is to make a .cmd
or .bat file called test.bat
Then you can quote the string like this -
dir "C:\documents and settings\administrator\local settings\temp" > fred.txt
(just for example - that's puts the dir listing in a file called fred.txt)
and put that sort of line in the bat file.
then the run command is just -
WshShell.Run("test.bat", 10, TRUE )
For deleting *.* you need the /Q for quiet mode like del /q
"Users\public........ etc.

That should help.

Cheers,
CreateWindow
http://justpageprobe.com
The FREE Web page utility you always wanted.
Keep your router connected.
Email your IP to where you need it.
Monitor your enterprise Web Servers.



Show quoteHide quote
"Trying to Learn" <TryingtoLe***@discussions.microsoft.com> wrote in message
news:EE0B8DC1-708A-4885-8304-BE5AC50ABA6E@microsoft.com...
> Hi again,
>
> Sorry, I tried using the full name but it has a space in it "public
> documents".  I don't know how to get around it.
>
> Thanks again ... Sam
>
> "CreateWindow" wrote:
>
>> Hi,
>>
>> That was probably not right.
>> What about specifying the full name?
>>
>> CreateWindow
>>
>>
>>
>> "Trying to Learn" <TryingtoLe***@discussions.microsoft.com> wrote in
>> message
>> news:AE02C341-B21D-41C7-ACBC-DC8BCB3A62E9@microsoft.com...
>> > Thanks for your response.  I am still having a problem, but have a
>> > question.
>> >
>> > When I typed the path to the files I want to delete I used a sub
>> > directory
>> > called public~1.  If I typed the complete name it would have been ...
>> > public
>> > documents.  The problem is that I have 4 other sub directories starting
>> > with
>> > public.
>> >
>> > In Vista I have  .....
>> >
>> > Public Documents  (what I need to path to)
>> > Public Downloads
>> > Public Music
>> > Public Pictures
>> > Public Videos
>> >
>> > That is why I used public~1  (I tried 2,3,4,5 also with no luck)
>> >
>> > Was that right?
>> >
>> >
>> > "CreateWindow" wrote:
>> >
>> >> Hi,
>> >>
>> >> Something like this should work.
>> >>
>> >> delstr1 = "cmd /c del c:\users\public\public~1\cqgnet\temp\*.*"
>> >> delstr2 = "cmd /c del
>> >> c:\users\public\public~1\cqgnet\private\bourtov.*"
>> >>
>> >> Set WshShell = WScript.CreateObject("WScript.Shell")
>> >>   ExitCode = WshShell.Run(delstr1, 10, TRUE )
>> >>   ExitCode = WshShell.Run(delstr2, 10, TRUE )
>> >> Set WshShell = Nothing
>> >>
>> >> You can test the ExitCode if you like. I think the above is ok -
>> >> anyway
>> >> it
>> >> will get you started.
>> >>
>> >> CreateWindow
>> >> http://justpageprobe.com
>> >> The FREE Web page utility you always wanted.
>> >> Keep your router connected.
>> >> Email your IP to where you need it.
>> >> Monitor your enterprise Web Servers.
>> >>
>> >>
>> >> "Trying to Learn" <Trying to Le***@discussions.microsoft.com> wrote in
>> >> message news:7CA962B7-EC33-422E-B4FF-E83A84760728@microsoft.com...
>> >> > Hi,
>> >> >
>> >> > I was trying to write a simple batch file in Vista, and discovered
>> >> > that
>> >> > I
>> >> > need to do these tasks in the form of a script.  I have no
>> >> > experience
>> >> > with
>> >> > scripts.  I felt pretty fortunate that I could get things done using
>> >> > batch
>> >> > files.  I'm an old DOS guy.  This is the task I need automated .....
>> >> >
>> >> > del c:\users\public\public~1\cqgnet\temp\*.*
>> >> > del c:\users\public\public~1\cqgnet\private\bourtov.*
>> >> >
>> >> > I have tried to no avail to convert this to a script.  Any help
>> >> > would
>> >> > be
>> >> > deeply appreciated as I would learn a lot if I saw it in script.
>> >> >
>> >> > Thank you ... Sam
>> >>
>> >>
>> >>
>>
>>
>>