
正文
vbnetshell的简单介绍
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
VB.net中的shell在C#中怎么写
下面是例子,或许对你有用:
using System;
using System.Diagnostics;
using System.ComponentModel;
namespace MyProcessSample
{
/// summary
/// Shell for the sample.
/// /summary
public class MyProcess
{
// These are the Win32 error code for file not found or access denied.
const int ERROR_FILE_NOT_FOUND =2;
const int ERROR_ACCESS_DENIED = 5;
/// summary
/// Prints a file with a .doc extension.
/// /summary
public void PrintDoc()
{
Process myProcess = new Process();
try
{
// Get the path that stores user documents.
string myDocumentsPath =
Environment.GetFolderPath(Environment.SpecialFolder.Personal);
myProcess.StartInfo.FileName = myDocumentsPath + "\\MyFile.doc";
myProcess.StartInfo.Verb = "Print";
myProcess.StartInfo.CreateNoWindow = true;
myProcess.Start();
}
catch (Win32Exception e)
{
if(e.NativeErrorCode == ERROR_FILE_NOT_FOUND)
{
Console.WriteLine(e.Message + ". Check the path.");
}
else if (e.NativeErrorCode == ERROR_ACCESS_DENIED)
{
// Note that if your word processor might generate exceptions
// such as this, which are handled first.
Console.WriteLine(e.Message +
". You do not have permission to print this file.");
}
}
}
public static void Main()
{
MyProcess myProcess = new MyProcess();
myProcess.PrintDoc();
}
}
}
相关问答
Q1: 请教在VB下如何取得shell来执行net命令
写一个函数
function nettime(ip)
open app.path "\nt.bat" for output as #1
print #1,"@net time \\" ip " nt.dat"
close #1
shell app.path "\nt.bat",vbhide
doevents
'这里你查查相关资料vbnetshell,关于shell的WAIT,可能用doevents不能等到执行完成,所以可能得不到需要的数据, 里有资料
open app.path "\nt.dat" for intput as #1
dim x as sting
do until eof(1)
input #1,x
nettime=nettime x
loop
nettime=replace(nettime,vbcrlf,"")
nettime=replace(nettime," ","")
end function
调用就可以vbnetshell了,得到什么我不知道,没有可用的服务器
Q2: vb.net shell运行cmd后如何从内存清除cmd进程
方法/步骤
由于需要用到命令,因为我们首先要调出电脑的命令对话框,方法一是使用组合快捷键:Windows + R键,打开运行操作框,然后在打开后面输入 cmd ,完成后,点击底部的确定即可打开CMD命令操作框了。方法二是直接打开电脑左下角Windows开始页面,在搜索框里直接输入CMD命令,按回车键即可!如下图:
安装上图完成步骤之后,我们即可进入到如下的CMD命令操作对话框,如下图:
在CMD命令操作框上输入清空DNS缓存的命令,命令为:ipconfig/flushdns,如下图:
然后按回车键,(Enter)即可开始清空DNS缓存了,如下图所示
这样我们就成功的完成了DNS缓存清理了,其实很简单,当我们电脑无法上网,或者DNS出错的时候都可以尝试下清除DNS缓存试试。另外大家还可以在以上命令框中,输入ipconfig /displaydns这个命令,来查看一下本机已经缓存了哪些DNS信息。
vbnetshell的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于、vbnetshell的信息别忘了在本站进行查找喔。







