Probleme execution VBS sous windows 10

Probleme execution VBS sous windows 10 - VB/VBA/VBS - Programmation

Marsh Posté le 16-12-2017 à 12:05:34    

Bonjour,
je rencontre un problème lors du lancement d'un script vbs de suppression des fichiers temp sous windows 10.
L'erreur semble se situer dans : Set fich = fso.OpenTextFile("c:\rien.txt", 1, false)
Le msg erreur est : fichier introuvable code 800A0035 erreur execution MS vbscript
 
Pouvez-vous m'aider sachant que le fichier c:\rien.txt n'existe pas mais cet ordre semble servir à initialiser fich
Ce script fonctionnait bien dans les versions antérieurs de windows.
Merci d'avance.

Reply

Marsh Posté le 16-12-2017 à 12:05:34   

Reply

Marsh Posté le 16-12-2017 à 13:49:16    

Ton code renvoie chez moi le même message d'erreur sous windows 7.
 
Voici ce que dit la doc microsoft vbs sur la méthode OpenTextFile :
 
openTextFile : Opens a specified file and returns a TextStream object that can be used to read from, write to, or append to the file.
 
 object.OpenTextFile(filename[, iomode[, create[, format]]])
 
 Arguments :  
  object : Required. Object is always the name of a FileSystemObject.
 
  filename : Required. String expression that identifies the file to open.
 
  iomode : Optional. Can be one of three constants: ForReading, ForWriting, or ForAppending.
 
  create : Optional. Boolean value that indicates whether a new file can be created if the specified filename doesn't exist. The value is True if a new file is created, False if it isn't created. If omitted, a new file isn't created.
 
  format : Optional. One of three Tristate values used to indicate the format of the opened file. If omitted, the file is opened as ASCII.  
 
Si je remplace false par true, plus de message d'erreur, car le fichier qui n'existe pas est créé et peut donc être ouvert.

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed