5 Replies - 986 Views - Last Post: 11 June 2013 - 02:46 PM Rate Topic: -----

#1 Supraman9291  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 07-June 13

Batch file can not be created?

Posted 11 June 2013 - 01:37 PM

I am trying to create a batch file using asp.net. It is supposed to be created off a button click, the button works but the .bat file is not showing up on the file location when the button is executed.

 var sText, s;
    var fso = new ActiveXObject("Scripting.FileSystemObject");

    if (!fso.FileExists("C:\\COO_BTO_Test.bat")) {
        s = fso.CreateTextFile("C:\\COO_BTO_Test.bat", true);
        sText = "@echo off";
        s.WriteLine(sText);

        sText = ":Lbl";
        s.WriteLine(sText);

        sText = "ECHO \"^XA^MD0^PRB^JVY^LL1760^LH%XL%,%YL%^FS   \">> COO.TXT";
        s.WriteLine(sText);

        sText = "ECHO \"^FO66,08^BY2,2.0,32^BCN,N,N,N^SN%Sno0%,1,Y^FS   \">> COO.TXT";
        s.WriteLine(sText);

        sText = "ECHO \"^FO66,48^AF,8,8^SN%Sno0%,1,Y^FS     \">> COO.TXT";
        s.WriteLine(sText);

        sText = ":END";
        s.WriteLine(sText);

        sText = "ECHO \"^PQ1     \">> COO.TXT";
        s.WriteLine(sText);

        sText = "ECHO \"^XZ     \">> COO.TXT";
        s.WriteLine(sText);

        sText = "REM MODE COM1 9600"
        s.WriteLine(sText);

        sText = "REM TYPE COO.TXT > COM1"
        s.WriteLine(sText);

        sText = "TYPE COO.TXT > LPT1"
        s.WriteLine(sText);
    }


Is This A Good Question/Topic? 0
  • +

Replies To: Batch file can not be created?

#2 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 9574
  • View blog
  • Posts: 36,262
  • Joined: 12-June 08

Re: Batch file can not be created?

Posted 11 June 2013 - 01:53 PM

Why would you be creating a batch file on the c drive of the server where this is deployed?
Was This Post Helpful? 0
  • +
  • -

#3 Supraman9291  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 07-June 13

Re: Batch file can not be created?

Posted 11 June 2013 - 02:14 PM

I'm alittle confused.. could you explain what I should do?
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 9574
  • View blog
  • Posts: 36,262
  • Joined: 12-June 08

Re: Batch file can not be created?

Posted 11 June 2013 - 02:15 PM

Stop and think for a minute - where do ASP pages run? You know - the active _SERVER_ pages? On the server right? So if you try and reference a path where do you think that is being referenced to? The server, right?
Was This Post Helpful? 0
  • +
  • -

#5 Supraman9291  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 07-June 13

Re: Batch file can not be created?

Posted 11 June 2013 - 02:31 PM

Okay, how would I create this on the local client?
Was This Post Helpful? 0
  • +
  • -

#6 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 9574
  • View blog
  • Posts: 36,262
  • Joined: 12-June 08

Re: Batch file can not be created?

Posted 11 June 2013 - 02:46 PM

Again this is where we stop and think about what you want. You want some random website to create files on a local machine. Doesn't that sound like what is inherently blocked through basic browser security - or, I mean, what would stop every page to spike virus, malware, spyware, etc on the person's machine?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1