Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > it.comp.lang.visual-basic > #19572
| From | SB <stNOOObenevSPAM@tin.it> |
|---|---|
| Newsgroups | it.comp.lang.visual-basic |
| Subject | Re: Aggiungere carattere in stringa registro |
| Date | 2019-03-11 21:32 +0100 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <o1hd8e5v29bo4otdastb2cej0n07ofp8e0@4ax.com> (permalink) |
| References | <q6639b$pq6$1@gioia.aioe.org> |
Il giorno Mon, 11 Mar 2019 17:44:28 +0100, "Cerebus" <Cerebus@test.it> ha
scritto:
>Salve.
>Ho bisogno di un aiuto.
>
>Ho una chiave di registro a cui ho necessita' di aggiungere un carattere
>(uno qualsiasi), e poi di riportarla com'era.
>Il tutto deve essere eseguito (o richiamabile) da file batch.
>
>Esempio: la chiave contiene "computer"
>
>Il batch esegue alcune operazioni (copie di file, cancellazioni, etc), poi
>dovrebbe leggere una certa chiave di registro, che in questo caso contiene
>"computer", la cambia (per esempio in computer-) e continua.
>Proseguendo nel batch, poi dovrebbe rimetere la chiave a posto, in questo
>caso togliendo "-" alla chiave.
>
>Per esempio, il file bat contiene:
>
>cd\windows
>del file.exe
>copy nomefile.exe c:\
>script.vbs <<< cambia una chiave aggiungendo "-"
>copy altronome.exe c:\
>script2.vbs <<< rimette a posto la chiave togliendo "-"
>
>E' possibile fare cio' con uno script in VBS?
>
>La chiave e'
>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName
>
>E' ovvio che il tutto verra' eseguito con i privilegi adeguati.
>E' altrettanto ovvio che la chiave cambia da PC a PC, altrimenti non mi
>servirebbe alcun tipo di programmazione :)
>
>Magari e' pure fattibile direttamente in batch, ma non ho idea di come.
>Un aiuto, magari in VBS?
In VBS si può facilmente usare il registy
Un esempio che mi e servito:sono salvato e che mi è servito:
___________________________________
Set wShell = CreateObject( "WScript.Shell" )
'
' Create a new DWORD value:
wshShell.RegWrite "HKCU\TestKey\DWordTestValue", 1, "REG_DWORD"
' Create a new subkey and a string value in that new subkey:
wshShell.RegWrite "HKCU\TestKey\SubKey\StringTestValue", "Test", "REG_SZ"
' Read the values we just created:
WScript.Echo "HKCU\TestKey\DWordTestValue = " _
& wshShell.RegRead( "HKCU\TestKey\DWordTestValue" )
WScript.Echo "HKCU\TestKey\SubKey\StringTestValue = """ _
& wshShell.RegRead( "HKCU\TestKey\SubKey\StringTestValue" ) & """"
' Delete the subkey and key and the values they contain:
wshShell.RegDelete "HKCU\TestKey\SubKey\"
wshShell.RegDelete "HKCU\TestKey\"
' Note: Since the WSH Shell has no Enumeration functionality, you cannot
' use the WSH Shell object to delete an entire "tree" unless you
' know the exact name of every subkey.
' If you don't, use the WMI StdRegProv instead.
' Release the object
Set wshShell = Nothing
___________________________
Per adattarlo alle tue esigenze naturalmente devi sostituire la stringa con il
valore del registro.
--
ciao
Stefano
Back to it.comp.lang.visual-basic | Previous | Next — Previous in thread | Next in thread | Find similar
Aggiungere carattere in stringa registro "Cerebus" <Cerebus@test.it> - 2019-03-11 17:44 +0100
Re: Aggiungere carattere in stringa registro SB <stNOOObenevSPAM@tin.it> - 2019-03-11 21:32 +0100
Re: Aggiungere carattere in stringa registro "Cerebus" <Cerebus@test.it> - 2019-03-11 21:50 +0100
Re: Aggiungere carattere in stringa registro SB <stNOOObenevSPAM@tin.it> - 2019-03-12 14:31 +0100
Re: Aggiungere carattere in stringa registro "Cerebus" <Cerebus@test.it> - 2019-03-12 14:47 +0100
Re: Aggiungere carattere in stringa registro SB <stNOOObenevSPAM@tin.it> - 2019-03-12 15:36 +0100
Re: Aggiungere carattere in stringa registro "Cerebus" <Cerebus@test.it> - 2019-03-12 21:37 +0100
Re: Aggiungere carattere in stringa registro SB <stNOOObenevSPAM@tin.it> - 2019-03-13 11:10 +0100
Re: Aggiungere carattere in stringa registro "Cerebus" <Cerebus@test.it> - 2019-03-13 14:41 +0100
Re: Aggiungere carattere in stringa registro SB <stNOOObenevSPAM@tin.it> - 2019-03-13 15:37 +0100
Re: Aggiungere carattere in stringa registro "Cerebus" <Cerebus@test.it> - 2019-03-13 16:08 +0100
Re: Aggiungere carattere in stringa registro "Cerebus" <Cerebus@test.it> - 2019-03-13 15:27 +0100
Re: Aggiungere carattere in stringa registro SB <stNOOObenevSPAM@tin.it> - 2019-03-13 16:20 +0100
Re: Aggiungere carattere in stringa registro "Cerebus" <Cerebus@test.it> - 2019-03-13 17:00 +0100
Re: Aggiungere carattere in stringa registro SB <stNOOObenevSPAM@tin.it> - 2019-03-13 17:19 +0100
Re: Aggiungere carattere in stringa registro "Cerebus" <Cerebus@test.it> - 2019-03-13 17:23 +0100
Re: Aggiungere carattere in stringa registro "Cerebus" <Cerebus@test.it> - 2019-03-13 17:49 +0100
Re: Aggiungere carattere in stringa registro SB <stNOOObenevSPAM@tin.it> - 2019-03-13 18:02 +0100
Re: Aggiungere carattere in stringa registro "Cerebus" <Cerebus@test.it> - 2019-03-13 18:20 +0100
Re: Aggiungere carattere in stringa registro SB <stNOOObenevSPAM@tin.it> - 2019-03-13 18:24 +0100
Re: Aggiungere carattere in stringa registro "Cerebus" <Cerebus@test.it> - 2019-03-13 18:31 +0100
Re: Aggiungere carattere in stringa registro SB <stNOOObenevSPAM@tin.it> - 2019-03-13 18:58 +0100
Re: Aggiungere carattere in stringa registro "Cerebus" <Cerebus@test.it> - 2019-03-13 20:41 +0100
Re: Aggiungere carattere in stringa registro "Cerebus" <Cerebus@test.it> - 2019-03-13 21:30 +0100
Re: Aggiungere carattere in stringa registro SB <stNOOObenevSPAM@tin.it> - 2019-03-13 23:03 +0100
Re: Aggiungere carattere in stringa registro "Cerebus" <Cerebus@test.it> - 2019-03-14 23:10 +0100
Re: Aggiungere carattere in stringa registro "Cerebus" <Cerebus@test.it> - 2019-03-14 23:21 +0100
Re: Aggiungere carattere in stringa registro SB <stNOOObenevSPAM@tin.it> - 2019-03-15 13:09 +0100
Re: Aggiungere carattere in stringa registro SB <stNOOObenevSPAM@tin.it> - 2019-03-15 13:20 +0100
Re: Aggiungere carattere in stringa registro "Cerebus" <Cerebus@test.it> - 2019-03-15 14:57 +0100
Re: Aggiungere carattere in stringa registro SB <stNOOObenevSPAM@tin.it> - 2019-03-15 13:31 +0100
Re: Aggiungere carattere in stringa registro "Cerebus" <Cerebus@test.it> - 2019-03-15 14:56 +0100
Re: Aggiungere carattere in stringa registro SB <stNOOObenevSPAM@tin.it> - 2019-03-15 19:10 +0100
Re: Aggiungere carattere in stringa registro SB <stNOOObenevSPAM@tin.it> - 2019-03-13 23:10 +0100
Re: Aggiungere carattere in stringa registro "Cerebus" <Cerebus@test.it> - 2019-04-28 23:43 +0200
csiph-web