Condividi:        

Creare un link ad un file da linea di comando

Hai problemi con i file Zip, vuoi formattare l'HD, non sai come funziona FireFox? O magari ti serve proprio quel programmino di cui non ricordi il nome! Ecco il forum dove poter risolvere i tuoi problemi.

Moderatori: Dylan666, hydra, gahan

Creare un link ad un file da linea di comando

Postdi neurone » 28/05/03 13:09

Ciao,
qualcuno saprebbe indicarmi un qualcosa di equivalente per windows a "ln" in unix?
Grazie
If the future is hidden and the past is visible....then you must be facing the wrong way!!!
neurone
Utente Junior
 
Post: 16
Iscritto il: 23/05/02 22:36
Località: ospedale paolo pini milano

Sponsor
 

Postdi neurone » 28/05/03 14:06

Alcuni elementi aggiuntivi che possono essere utili per far capire cosa sto cercando di fare:
devo creare dei shortcut a molti files con dei nomi definiti, quindi mi servirebbe un comendo tipo "ln" in unix che inserirei poi in un piccolo eseguibile!
If the future is hidden and the past is visible....then you must be facing the wrong way!!!
neurone
Utente Junior
 
Post: 16
Iscritto il: 23/05/02 22:36
Località: ospedale paolo pini milano

Postdi Nippur_ge » 28/05/03 17:06

Non riesco comunuque a capire l'utilità della cosa.

ln in Unix crea il Symbolic Name, che è di fatto una reference a livello di file system.
I collegamenti su Windows sono un po diversi.
Tu vorresti un qualcosa che crea i file .lnk che puntano invece ad un altro file fisico?

Tieni presente che un .lnk ha tante informazioni, non solo la reference sul FS. se riesci ad inquadrare meglio l'esigenza magari vediamo se c'è un workaround o un tool.
Nippur_ge
Utente Senior
 
Post: 166
Iscritto il: 13/05/03 09:08
Località: Genova

Postdi SoftIc3 » 30/05/03 11:45

nn so se ho capito bene il tuo problema...
cmq avevo pensato ad un batch link.bat richiamato da riga di comando
suppendendo che voglio creare un link a notepad.exe:

c:\>link.bat "c:\winnt\notepad.exe"

nel file link.bat ci deve essere
--------------------------------------------------------------------------------

@echo off & setlocal
if not %1[==[ if exist %1 goto AVVIO
if not %1[==[ echo %1 IL FILE NN ESISTE!!!
(pause & endlocal & goto:eof)
:AVVIO
(set hkey=HKEY_CURRENT_USER\Software\Microsoft\Windows)
(set hkey=%hkey%\CurrentVersion\Explorer\Shell Folders)
(set inf=rundll32 setupapi,InstallHinfSection DefaultInstall)
start/w regedit /e %temp%\PROVA.tmp "%hkey%"
for /f "tokens=*" %%? in (
'dir/b/a %1? 2^>nul') do (set name=%%~nx?)
(set d=%d:\\=\%) & (set p=%p:\\=\%)
if not %2[==[ if exist %~fs2\nul (set d=%~fs2)
if not %2[==[ if exist %~fs2\nul (set d=%~fs2)
set x=if exist %2\nul
if not %2[==[ if not %d%==%2 %x% if "%~p2"=="\" set d=%2
echo %d%¦find ":\" >nul|(set d=%d%\)
(set file=""""""%1"""""")
for /f "tokens=1 delims=:" %%? in ("%file:"=%") do set drive=%%?
(set progman=setup.ini, progman.groups,,)
echo > %temp%\PROVA.inf [version]
echo >>%temp%\PROVA.inf signature=$chicago$
echo >>%temp%\PROVA.inf [DefaultInstall]
echo >>%temp%\PROVA.inf UpdateInis=Addlink
echo >>%temp%\PROVA.inf [Addlink]
echo >>%temp%\PROVA.inf %progman% ""group200="LINK"""
echo >>%temp%\PROVA.inf setup.ini, group200,, """%name%"",%file%
start/w %inf% 132 %temp%\PROVA.inf
del %temp%\PROVA.inf %temp%\PROVA.tmp
endlocal

--------------------------------------------------------------------------------


il batch crea un collegamento al file notepad.exe
e lo sbatte nella cartella menu avvio\programmi\LINK
come dice nippur_ge, un .lnk ha tante informazioni, non solo la reference sul FS;
il batch in pratica crea un file .INF con tutte le info necessarie per il link
dopodiche' lo elimina
tieni presente che funge solo con winnt/2k, quindi se ti serve per win95/98 bisogna fare delle variazioni

ciao
SoftIc3
Utente Junior
 
Post: 78
Iscritto il: 14/01/03 22:04
Località: Lucca

Postdi Nicola » 30/05/03 13:13

per fare un link servono tutte quelle informazioni :o :?:
Nicola
Nicola
Utente Senior
 
Post: 7381
Iscritto il: 08/02/02 01:00

Postdi SoftIc3 » 30/05/03 14:52

link.bat

--------------------------------------------------------------------

@echo off & setlocal
if not %1[==[ if exist %1 goto AVVIO
if not %1[==[ echo %1 IL FILE NN ESISTE!!!
(pause & endlocal & goto:eof)
:AVVIO
(set hkey=HKEY_CURRENT_USER\Software\Microsoft\Windows)
(set hkey=%hkey%\CurrentVersion\Explorer\Shell Folders)
(set inf=rundll32 setupapi,InstallHinfSection DefaultInstall)
start/w regedit /e %temp%\PROVA.tmp "%hkey%"
for /f "tokens=*" %%? in (
'dir/b/a %1? 2^>nul') do (set name=%%~nx?)
(set d=%d:\\=\%)
(set file=""""""%1"""""")
(set progman=setup.ini, progman.groups,,)
echo > %temp%\PROVA.inf [version]
echo >>%temp%\PROVA.inf signature=$chicago$
echo >>%temp%\PROVA.inf [DefaultInstall]
echo >>%temp%\PROVA.inf UpdateInis=Addlink
echo >>%temp%\PROVA.inf [Addlink]
echo >>%temp%\PROVA.inf %progman% ""group200="LINK"""
echo >>%temp%\PROVA.inf setup.ini, group200,, """%name%"",%file%
start/w %inf% 132 %temp%\PROVA.inf
del %temp%\PROVA.inf %temp%\PROVA.tmp
endlocal

--------------------------------------------------------------------

passo dal file .inf perche' nn mi viene in mente nulla di + semplice :(
SoftIc3
Utente Junior
 
Post: 78
Iscritto il: 14/01/03 22:04
Località: Lucca

Postdi neurone » 02/06/03 09:45

Grazie,
Lo testo e vi faccio sapere.
If the future is hidden and the past is visible....then you must be facing the wrong way!!!
neurone
Utente Junior
 
Post: 16
Iscritto il: 23/05/02 22:36
Località: ospedale paolo pini milano


Torna a Software Windows


Topic correlati a "Creare un link ad un file da linea di comando":


Chi c’è in linea

Visitano il forum: Nessuno e 76 ospiti