Visualizzazione dei risultati da 1 a 3 su 3
  1. #1

    Stampare più stringhe in un file con la linea di discontinuità in bat

    Vorrei aggiungere a un file di testo (con percorso assoluto) tante stringhe (una sotto l'altra). Pensavo di aver trovato la soluzione utilizzando questo esempio:

    codice:
    echo hello & echo.world
    Ma quando eseguo il mio programma, il programma aggiunge solo l'ultima stringa al file di testo (che è # 127.0.0.1 spclient.wg.spotify.com).

    Conoscete qualche soluzione?

    Questo è il mio codice bat

    codice:
    echo 127.0.0.1 media-match.com & echo.127.0.0.1 adclick.g.doublecklick.net & echo.127.0.0.1 www.googleadservices.com & echo.127.0.0.1 media-match.com & echo.127.0.0.1 adclick.g.doublecklick.net & echo.127.0.0.1 www.googleadservices.com & echo.127.0.0.1 pagead2.googlesyndication.com & echo.127.0.0.1 googleads.g.doubleclick.net & echo.127.0.0.1 pubads.g.doubleclick.net & echo.127.0.0.1 securepubads.g.doubleclick.net & echo.127.0.0.1 www.omaze.com & echo.127.0.0.1 omaze.com & echo.127.0.0.1 bounceexchange.com & echo.127.0.0.1 core.insightexpressai.com & echo.127.0.0.1 content.bitsontherun.com & echo.127.0.0.1 s0.2mdn.net & echo.127.0.0.1 v.jwpcdn.com & echo.127.0.0.1 d2gi7ultltnc2u.cloudfront.net & echo.127.0.0.1 cs283.wpc.teliasoneracdn.net & echo.127.0.0.1 cs126.wpc.teliasoneracdn.net & echo.127.0.0.1 u.scdn.co & echo.127.0.0.1 cs126.wpc.edgecastcdn.net & echo.127.0.0.1 pagead46.l.doubleclick.net & echo.127.0.0.1 pagead.l.doubleclick.net & echo.127.0.0.1 video-ad-stats.googlesyndication.com & echo.127.0.0.1 pagead-googlehosted.l.google.com & echo.127.0.0.1 partnerad.l.doubleclick.net & echo.127.0.0.1 prod.spotify.map.fastlylb.net & echo.127.0.0.1 adserver.adtechus.com & echo.127.0.0.1 na.gmtdmp.com & echo.127.0.0.1 anycast.pixel.adsafeprotected.com & echo.127.0.0.1 ads.pubmatic.com & echo.127.0.0.1 idsync-ext.rlcdn.com & echo.127.0.0.1 www.googletagservices.com & echo.127.0.0.1 googlehosted.l.googleusercontent.com & echo.127.0.0.1 d361oi6ppvq2ym.cloudfront.net & echo.127.0.0.1 gads.pubmatic.com & echo.127.0.0.1 ads-west-colo.adsymptotic.com & echo.127.0.0.1 geo3.ggpht.com & echo.127.0.0.1 showads33000.pubmatic.com & echo.127.0.0.1 crashdump.spotify.com & echo.127.0.0.1 adeventtracker.spotify.com & echo.127.0.0.1 log.spotify.com & echo.127.0.0.1 analytics.spotify.com & echo.127.0.0.1 ads-fa.spotify.com & echo.127.0.0.1 audio-ec.spotify.com & echo.127.0.0.1 sto3.spotify.com & echo.127.0.0.1 audio2.spotify.com & echo.127.0.0.1 http://audio2.spotify.com & echo.127.0.0.1 www.audio2.spotify.com & echo.127.0.0.1 desktop.spotify.com & echo.127.0.0.1 heads-ec.spotify.com & echo.127.0.0.1 open.spotify.com & echo.#127.0.0.1 spclient.wg.spotify.com >> C:\Users\utente\Documents\bersaglio.txt



    Ho generato il codice con un programma che ho realizzato in c #, questo è il codice:

    codice:
    using System;using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    
    namespace ConsoleApplication1
    {
        class Program
        {
            static void Main(string[] args)
            {
    
    
    
    
                String n = "\\n", n2;
                String finale = "";
    
    
                Console.WriteLine("This little program is used to insert '& echo.'between 2 or more output strings \n \n \nHow many strings do you have?");
                int stringhe = Convert.ToInt16(Console.ReadLine());
    
    
                for (int i = 0; i < stringhe; i++)
                {
                    
                    Console.Clear();
                    Console.WriteLine("enter string number " + (i + 1));
                    n = Console.ReadLine();
                    finale = finale +" & echo." + n;
                }
    
    
                Console.WriteLine(finale);
    
    
                String terminadebug = Console.ReadLine();
    
    
            }
        }
    }

  2. #2
    eh? il problema è nel .bat? è nel codice? il codice genera male il .bat? il .bat fa scuocere la pasta?

  3. #3
    il codice c# non c'entra niente era solo per far vedere come avevo generato lunga stringa di testo. Il problema era nel bat. ma ho risolto.Bastava semplicemente aggiungere le parentesi:
    codice:
    (echo 127.0.0.1 media-match.com & echo.127.0.0.1 adclic [...]) >> "file.ext"
    Quote Originariamente inviata da optime Visualizza il messaggio
    eh? il problema è nel .bat? è nel codice? il codice genera male il .bat? il .bat fa scuocere la pasta?

Tag per questa discussione

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.