Re: Scripts in Vista



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.



"Trying to Learn" <TryingtoLearn@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:EE0B8DC1-708A-4885-8304-BE5AC50ABA6E@xxxxxxxxxxxxxxxx
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" <TryingtoLearn@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message
news:AE02C341-B21D-41C7-ACBC-DC8BCB3A62E9@xxxxxxxxxxxxxxxx
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 Learn@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message news:7CA962B7-EC33-422E-B4FF-E83A84760728@xxxxxxxxxxxxxxxx
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








.



Relevant Pages

  • Re: Problem with a "simple" script
    ... RichardOnRails you are welcome in this group and others at any time. ... >>>> I'm failing in my attempt to run a command from within a script. ... >> The only blemish is that this scheme brings up a temporary Cmd ... > I ditched the .bat file in favor of: ...
    (microsoft.public.scripting.wsh)
  • Re: Script to Search and Delete Files from Remote Machines
    ... Put this in a bat file and run from CMD: ... Make sure you have a folder named 'logs' on C drive, each computer will have its own log file in that directory. ... i need my script to pick machine names from a text ...
    (microsoft.public.windows.server.scripting)
  • Re: ScreenSaverGracePeriod
    ... Because the regkey correspondents to HK LOCAL MACHINE run it as a startup script not as a logon script. ... The user will have no rights to modify the registry. ... This posting is provided "AS IS" with no warranties, and confers no rights. ... I created a bat file and a registry file and and set it all up ...
    (microsoft.public.windows.server.active_directory)
  • Re: Mapped Drives and Home Folders
    ... In Active Directory Users and Computers, ... On the Logon script line, ... name of the .bat file - do not include a path. ... Put it a shared folder with read only access. ...
    (microsoft.public.windows.server.general)
  • Re: How can I kill a stuck cmd.exe remotely?
    ... sample script code... ... Microsoft MVP - Windows Server Management Infrastructure ... > the cmd would stuck for some reasons I did not know. ... > something in order to run the WMI thing? ...
    (microsoft.public.windowsxp.wmi)

Loading