472,146 Members | 1,408 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,146 software developers and data experts.

objWshell.run "%COMSPEC% /C d:\rd teste", 0, TRUE ????

Hi folks,

I got samples on http://www.aspfaq.com/show.asp?id=2059 and runs ok to dir
ms-dos command, but to others commands like del, rd, deltree, etc... it has
not had any effect, even it has not returned errors.
ANY secret??
Using batch file is possible, but and using "%COMSPEC% /C ??
I read all help from ms-dos to "%COMSPEC% , but untill now I could not find
solution!
thanks!

Set objWshell = CreateObject("WScript.Shell")

objWshell.run "%COMSPEC% /C d:\rd teste", 0, TRUE '»»it has no effect.
objWshell.run "%COMSPEC% /C dir *.txt d:\ > d:\dir.txt", 0, TRUE '»»here
runs OK

Set objWshell = nothing
Jul 19 '05 #1
3 6438
> I got samples on http://www.aspfaq.com/show.asp?id=2059 and runs ok to dir
ms-dos command, but to others commands like del, rd, deltree, etc... it has not had any effect, even it has not returned errors.


Probably a permissions issue. Try forcing windows authentication in IIS,
and authenticating against the web page with credentials of a user that has
the ability to do those things, and see if the results are different.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
Jul 19 '05 #2

"news.microsoft.com" <su*****@hitecnet.com.br> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hi folks,

I got samples on http://www.aspfaq.com/show.asp?id=2059 and runs ok to dir
ms-dos command, but to others commands like del, rd, deltree, etc... it has not had any effect, even it has not returned errors.
ANY secret??
Using batch file is possible, but and using "%COMSPEC% /C ??
I read all help from ms-dos to "%COMSPEC% , but untill now I could not find solution!
thanks!

Set objWshell = CreateObject("WScript.Shell")

objWshell.run "%COMSPEC% /C d:\rd teste", 0, TRUE '»»it has no effect.
With that line, you aren't doing anything. If you want to rd a directory,
use "rd D:\teste."

objWshell.run "%COMSPEC% /C dir *.txt d:\ > d:\dir.txt", 0, TRUE '»»here


That line will execute two separate dir commands. One for *.txt and one for
D:\. Is that what you want? Or do you really want:

dir D:\*.txt

After you get the probable permissions issues fixed as Aarons suggested, you
should delete the spaces before and after the > redirect character.

D:\*.txt>D:\dir.txt

for example.

Ray at work
Jul 19 '05 #3
thank everybody!
now it is run marvellousy!
bye.
vilmar
brazil

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> escreveu na mensagem
news:uV**************@TK2MSFTNGP09.phx.gbl...

"news.microsoft.com" <su*****@hitecnet.com.br> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hi folks,

I got samples on http://www.aspfaq.com/show.asp?id=2059 and runs ok to dir ms-dos command, but to others commands like del, rd, deltree, etc... it has
not had any effect, even it has not returned errors.
ANY secret??
Using batch file is possible, but and using "%COMSPEC% /C ??
I read all help from ms-dos to "%COMSPEC% , but untill now I could not

find
solution!
thanks!

Set objWshell = CreateObject("WScript.Shell")

objWshell.run "%COMSPEC% /C d:\rd teste", 0, TRUE '»»it has no effect.


With that line, you aren't doing anything. If you want to rd a directory,
use "rd D:\teste."

objWshell.run "%COMSPEC% /C dir *.txt d:\ > d:\dir.txt", 0, TRUE

'»»here
That line will execute two separate dir commands. One for *.txt and one for D:\. Is that what you want? Or do you really want:

dir D:\*.txt

After you get the probable permissions issues fixed as Aarons suggested, you should delete the spaces before and after the > redirect character.

D:\*.txt>D:\dir.txt

for example.

Ray at work

Jul 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Hal Vaughan | last post: by
reply views Thread by Saiars | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.