Bonjour,
J'ai executer ce code provenant d'un autre forum (il permet de faire du .net en batch) :
Or à présent je ne peux plus utliser les commandes net du cmd à partir d'un .bat /.cmd, mais peux toujours les executer manuellement dans le cmd.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37 /* @echo off & cls for /F %%i in ('dir /B /S ^"%WinDir%\Microsoft.NET\Framework\csc.exe^"') do set csc=%%i if /i "%csc%"=="" EXIT %csc% /nologo /out:"%~0.exe" %0 "%~0.exe" del "%~0.exe" >NUL 2>&1 exit */ using System; using System.Runtime.InteropServices; class TestColor { const int STD_OUTPUT_HANDLE = -11; [DllImportAttribute("Kernel32.dll")] private static extern int GetStdHandle( int nStdHandle ); [DllImportAttribute("Kernel32.dll")] private static extern int SetConsoleTextAttribute (int hConsoleOutput, int wAttributes ); [STAThread] static void Main(string[] args) { for (int i = 1; i < 256; i++) { Console.WriteLine("BATCH.XOO.IT "); SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), i); } SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 7); System.Console.ReadLine(); } }
Message d'erreur lors de l'execution du .cmd :
J'ai lancé Ccleaner pour verifier le registre, il m'indique des DLL Shared manquantes :error CS2001: Source file 'net' could not be found
fatal error CS2008: No inputs specified
La syntaxe de cette commande est :
NET
[ ACCOUNTS | COMPUTER | CONFIG | CONTINUE | FILE | GROUP | HELP |
HELPMSG | LOCALGROUP | PAUSE | SESSION | SHARE | START |
STATISTICS | STOP | TIME | USE | USER | VIEW ]
Je pense vous avoir donner tout ce à quoi j'ai pensé.C:\Windows\Microsoft.NET\Framework\v1.0.3705\System.Windows.Forms.tlb Ox 1000
C:\Windows\Microsoft.NET\Framework\v1.0.3705\System.tlb Ox 1000
C:\Windows\Microsoft.NET\Framework\v1.0.3705\Microsoft.JScript.tlb Ox 1000
C:\Windows\Microsoft.NET\Framework\v1.0.3705\System.EnterpriseServices.tlb Ox 1000
C:\Windows\Microsoft.NET\Framework\v1.0.3705\System.Drawing.tlb Ox 1000
C:\Windows\Microsoft.NET\Framework\v1.0.3705\mscorlib.tlb Ox 1000
C:\Windows\Microsoft.NET\Framework\v1.0.3705\mscoree.tlb Ox 1000
Si quelqu'un sait ce que je peux faire pour résoudre ce problème, je suis preneur
PS: j'ai lancé un sfc /scannow, cela n'a pas résolu le problème.
Partager