0
For Each objFile in ObjFiles
Dim Dir , text, filetocheck
filetocheck = """" & objFile & """"
Dir = """C:\Program Files\PGP Corporation\PGP Desktop"""
Dim WshShell, oExec
Set WshShell = WScript.CreateObject("WScript.Shell")
Set objExec = WshShell.Exec("cmd /K pgpnetshare -v " & filetocheck)
Set oShell = CreateObject("WScript.Shell")
Set oWmg = GetObject("winmgmts:")
strWndprs = "select * from Win32_Process where name='cmd.exe'"
Set objQResult = oWmg.Execquery(strWndprs)
上面是VB Script代碼時需要幫助,我需要寫在Java.Here相同的代碼,我們正在執行一個CMD pgpnetshare -v名 我已經試過像這在翻譯VBScript代碼Java代碼
//For all files and folders in directory
for(int i=0; i<files.length; i++){
//Check if directory
if(files[i].isDirectory())
//Recursively call file list function on the new directory
VerifyFiles(files[i]);
else{
//If not directory, print the file path
String path = "C:\\Program Files\\PGP Corporation\\PGP Desktop";
Runtime rt = Runtime.getRuntime();
rt.exec("cmd /K pgpnetshare -v"+ files[i]);
}
}
}
我已經嘗試upto運行Pgpnetshare命令。有人能幫我解決代碼的其餘部分嗎?我
'rt.exec( 「CMD/K pgpnetshare -v」 + files [i]);' - 在-v之後應該有一個空格? –
堆棧溢出不是一項免費的移植服務。也就是說,你可以通過指出代碼的實際問題來幫助自己,而不是簡單地在這裏傾銷一堆代碼。如果你不知道「上面的代碼是對還是錯」,你可以試着運行代碼*來看看會發生什麼。 – MarsAtomic
@TagirValeev。感謝您的回覆,您可以在代碼的其餘部分使用我。 – user3493758