npcs
asked on
sc query > [filename] not working as a shell command in VB .NET... help?
The command I am trying to run in VB .net is as follows:
Shell("sc query > " & Chr(34) & "C:\Dir Name\ServicesRunning.txt" & Chr(34))
The Directory name has spaces and needs to keep them. I have output that code to a label and it reads exactly as it should:
sc query > "C:\Dir Name\ServicesRunning.txt"
Why Isn't it working? I really don't want to resort to my stop gap solution of running an external batch file to execute the command.
Shell("sc query > " & Chr(34) & "C:\Dir Name\ServicesRunning.txt" & Chr(34))
The Directory name has spaces and needs to keep them. I have output that code to a label and it reads exactly as it should:
sc query > "C:\Dir Name\ServicesRunning.txt"
Why Isn't it working? I really don't want to resort to my stop gap solution of running an external batch file to execute the command.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
While your here, is there any way in VB.net or shell to take a jpg screen shot?
ASKER