Error: Subscript out of range script vbs
Résolu
MrZoe
Messages postés
955
Statut
Membre
-
MrZoe Messages postés 955 Statut Membre -
MrZoe Messages postés 955 Statut Membre -
Bonjour,
J'ai faite un script qui prend un nom de fichier depuis la ligne de commande (cmd) et affiche toutes les propriété de l'objet File correspondant. Le script doit décoder aussi les attributs de fichier renvoyés.
le probleme quand je l'exécute j'ai un erreur :
Error Message:
Windows Script Host
Script: C:\userlocationchange.vbs
Line: 19
Char: 1
Error: Subscript out of range: '[number: 1]'
Code: 800A0009
Source: Microsoft VBScript runtime error
Merci de vos réponse
If NomFic = " " Then
Set FSO = CreateObject("Scripting.FileSystemObject")
NomFic = WScript.Arguments(0)
If FSO.FolderExists(NomFic) Then
'******** récupere attibuts
If NomFic.Attributes And 1 Then
strAttributs = "Fichier en lecture seule" & vbCrLf
End If
If NomFic.Attributes And 2 Then
strAttributs = "Fichier en lecture seule" & vbCrLf
End If
If NomFic.Attributes And 4 Then
strAttributs = "Fichier en lecture seule" & vbCrLf
End If
If NomFic.Attributes And 8 Then
strAttributs = "Fichier en lecture seule" & vbCrLf
End If
If NomFic.Attributes And 16 Then
strAttributs = "Fichier en lecture seule" & vbCrLf
End If
If NomFic.Attributes And 32 Then
strAttributs = "Fichier en lecture seule" & vbCrLf
End If
If NomFic.Attributes And 64 Then
strAttributs = "Fichier en lecture seule" & vbCrLf
End If
If NomFic.Attributes And 128 Then
strAttributs = "Fichier en lecture seule" & vbCrLf
End If
MsgBox "Le fichier possède les attributs: " & vbCrlf & StrAttibuts & NomFic.DateCreated &_
"Dernier modification" & NomFic.Date.LastModified & "Votre lecteur" & NomFic.Drive &_
"Nom du fichier" & NomFic.Name & "Le size du fichier" & NomFic.Size / 1024 & "Ko" &_
"Le type de fichier" & NomFic.Type
Else
MsgBox "Le fichier spécifié n'exite pas", vbExclamation
End If
J'ai faite un script qui prend un nom de fichier depuis la ligne de commande (cmd) et affiche toutes les propriété de l'objet File correspondant. Le script doit décoder aussi les attributs de fichier renvoyés.
le probleme quand je l'exécute j'ai un erreur :
Error Message:
Windows Script Host
Script: C:\userlocationchange.vbs
Line: 19
Char: 1
Error: Subscript out of range: '[number: 1]'
Code: 800A0009
Source: Microsoft VBScript runtime error
Merci de vos réponse
If NomFic = " " Then
Set FSO = CreateObject("Scripting.FileSystemObject")
NomFic = WScript.Arguments(0)
If FSO.FolderExists(NomFic) Then
'******** récupere attibuts
If NomFic.Attributes And 1 Then
strAttributs = "Fichier en lecture seule" & vbCrLf
End If
If NomFic.Attributes And 2 Then
strAttributs = "Fichier en lecture seule" & vbCrLf
End If
If NomFic.Attributes And 4 Then
strAttributs = "Fichier en lecture seule" & vbCrLf
End If
If NomFic.Attributes And 8 Then
strAttributs = "Fichier en lecture seule" & vbCrLf
End If
If NomFic.Attributes And 16 Then
strAttributs = "Fichier en lecture seule" & vbCrLf
End If
If NomFic.Attributes And 32 Then
strAttributs = "Fichier en lecture seule" & vbCrLf
End If
If NomFic.Attributes And 64 Then
strAttributs = "Fichier en lecture seule" & vbCrLf
End If
If NomFic.Attributes And 128 Then
strAttributs = "Fichier en lecture seule" & vbCrLf
End If
MsgBox "Le fichier possède les attributs: " & vbCrlf & StrAttibuts & NomFic.DateCreated &_
"Dernier modification" & NomFic.Date.LastModified & "Votre lecteur" & NomFic.Drive &_
"Nom du fichier" & NomFic.Name & "Le size du fichier" & NomFic.Size / 1024 & "Ko" &_
"Le type de fichier" & NomFic.Type
Else
MsgBox "Le fichier spécifié n'exite pas", vbExclamation
End If
A voir également:
- Subscript out of range vbs
- Cmos checksum error ✓ - Forum Carte-mère/mémoire
- Error 1962 ✓ - Forum PC fixe
- Playback error reconnect in 3s (1/5) francais - Forum Box et Streaming vidéo
- Bad request error 403 paiement ✓ - Forum Réseaux sociaux
- A javascript error occurred in the main process - Forum Matériel & Système